Skip to content
Snippets Groups Projects
Commit e27ab3b2 authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

add lib

parent 62e35952
No related branches found
No related tags found
No related merge requests found
^.*\.Rproj$
^\.Rproj\.user$
lib/
#!/usr/local/bin/Rscript
# Jean-Marie Lepioufle
# NILU - nilu.no
# 2020-08-14
# install
'install
Usage:
install.R pkg <pkg> branch <branch> dir <dir>
install.R (-h | --help)
install.R --version
Options:
-h --help Show this screen.
--version Show version.
Outcomes:
algoli: package algoli installed with the chosen version.
' -> doc
#library(docopt)
arguments <- docopt::docopt(doc, version = 'install version 0.0.1')
# arguments
pkg <- tryCatch({
res <- as.character(arguments$pkg)
res
}, error = function(err) {
print(paste("Error in argument 'pkg': ",err))
print("It will crash.")
})
branch <- tryCatch({
res <- as.character(arguments$branch)
res
}, error = function(err) {
print(paste("Error in argument 'branch': ",err))
print("It will crash.")
})
dir <- tryCatch({
res <- normalizePath(file.path(as.character(arguments$dir)),mustWork = FALSE)
res
}, error = function(err) {
print(paste("Error in argument 'dir': ",err))
print("It will crash.")
})
# install pkg
wd <- dirname(dirname(getwd()))
install.packages(file.path(dir,paste0(pkg,'-',branch,'.tar.gz')), repos=NULL, type='source')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment