parseCommandLine: Parse command line arguments via given ArgParser.

Description Usage Arguments Value Methods (by class) Examples

Description

Parse command line arguments via given ArgParser.

Usage

1
2
3
4
5
parseCommandLine(x, ...)

## S4 method for signature 'ArgParser'
parseCommandLine(x, cmdargs = commandArgs(),
  trim_prefix = FALSE)

Arguments

x

An ArgParser object.

...

Other arguments used in dispatched method.

cmdargs

A character vector representing command line arguments.

trim_prefix

A logical vector indicating wheather to strip dash prefix in argument names in parsed result.

Value

A list of parsed command line arguments.

Methods (by class)

Examples

1
2
3
4
5
6
library(magrittr)
cmdargs <- strsplit("prog.R --f1 v1", ' ')[[1]]
p <- ArgParser() %>%
   addFlag("--f1") %>%
   addFlag("--f2")
parseCommandLine(p, cmdargs=cmdargs)

everdark/ArgParser documentation built on May 16, 2019, 9:39 a.m.