Description Usage Arguments Details Value Functions See Also Examples
Parses an netrc file in different ways and return the credential specifications it contains.
1 2 3 4 | read_netrc(x = netrc_path(), std = TRUE, line.number = FALSE,
quiet = FALSE)
netrc_path()
|
x |
path or connection to an netrc file.
Default is to look for file |
std |
indicates if the file should be parsed as a standard netrc file ( |
line.number |
logical that indicates if the starting and ending line number of each credential definition should also be returned. |
quiet |
logical that indicates if the function should return |
Entries in the netrc file can be associated to R repositories, which are looked up
by install.pkgs
via repos_url
, by adding a comment line
to a standard entry the following format:
1 2 3 4 5 6 7 8 9 |
The first entry is standard and provide credentials for a named host.
The second entry starts with '#repos '
, which indicates it is an entry for an R repository
with shortcut key ('@myRepo'
) and an – optional – path
to the actual repository on the host machine 'www.myrepo.org'
.
Note that it is not mandatory to start the repository entry key with a '@'
, but it makes it clearer
that the first part of the path is a key to be substituted rather than being part of the path.
a character matrix with one row per credential and columns 'machine'
, 'login'
and 'password'
if std
is TRUE
or NA
, and additional columns
'repos'
and 'path'
if std = FALSE
.
netrc_path
: returns the default location of the .netrc
file.
This is by decreasing preference:
defined by global option netrc_path
file in current directory
file in the user home directory.
Other auth: repos_auth
,
repos_url
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
try( read_netrc() )
read_netrc(quiet = TRUE)
## End(Not run)
# using toy example
f <- system.file('netrc', package = 'repotools')
if( interactive() ) file.show(f) else cat(readLines(f), sep = "\n")
# standard parsing
read_netrc(f)
read_netrc(f, line.number = TRUE)
# parse repo information
read_netrc(f, std = FALSE)
# skip repo entries
read_netrc(f, std = NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.