Skip to content

Commit

Permalink
Add test script
Browse files Browse the repository at this point in the history
  • Loading branch information
jperkel committed Feb 11, 2022
1 parent 596e347 commit 81c6096
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test_cmdparseR.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
library(cmdparseR)

main <- function() {
init_command_line_parser('test_cmdparseR','Test cmdparseR package','0.1.0')

args <- list(
c('--config','-c','config','~/myconfigfile.txt',argsType$TypeValue,'Configuration file'),
c('--debug','-d','debug',FALSE,argsType$TypeBool,'Display debug messages'),
c('--keywords','-k','keywords',NA,argsType$TypeMultiVal,'Search keywords'),
c('--daterange','-r','daterange',NA,argsType$TypeRange,'Date range'),
c('--verbose','-v','verbose',0,argsType$TypeCount,'Verbosity level')
)
reg_argument_list(args)

pos <- list(
c('outfile',NA,'Output filename'),
c('infiles',NA,'Input filename(s)')
)
reg_positionals_list(pos)

args <- commandArgs(trailingOnly = TRUE)
mydata <- parse_command_line(args)

print(mydata)
}

main()

0 comments on commit 81c6096

Please sign in to comment.