Created
May 13, 2016 14:19
-
-
Save arbelt/bbfa009f285a3a615bda00edeb0b4ed5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
if (!require(pacman, quiet = TRUE)) install.packages("pacman") | |
pacman::p_load(docopt, dplyr, stringr, purrr) | |
" | |
Usage: | |
package.r [options] <pkgname> | |
package.r <pkgname> [-i <import>...] | |
Options: | |
-r --raw-data Use raw data | |
-i import..., --import import Specify imports (comma separated) | |
-v --verbose | |
" -> doc | |
opts <- docopt(doc) | |
if (opts$verbose) print(opts) | |
devtools::create(opts$pkgname) | |
if (isTRUE(opts$`raw-data`)) devtools::use_data_raw(opts$pkgname) | |
opts$import %>% | |
map(partial(devtools::use_package, pkg = opts$pkgname)) %>% | |
invisible | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment