addSwitch: Add switch argument to parser.

Description Usage Arguments Value Methods (by class) Examples

Description

Add switch argument to parser.

Usage

1
2
3
4
5
addSwitch(x, name, ...)

## S4 method for signature 'ArgParser,character'
addSwitch(x, name, short = NULL,
  states = FALSE, help = NULL)

Arguments

x

An ArgParser object.

name

Character vector of the switch name. Should be of length 1 and prefixed with "--".

...

Other arguments used in dispatched method.

short

Optional alias for the switch. Should be of length 1 and prefixed with "-".

states

Optional states of unpushed/pushed in list of length 2, or a logical vector of length 1 with the unpushed state.

help

Optional character vector shown in usage for the switch. If any, should be of length 1.

Value

An ArgParser with the switch definition added.

Methods (by class)

Examples

1
2
3
p <- ArgParser("a test parser")
p <- addSwitch(p, "--switch-logic", "-s1", FALSE)
p <- addSwitch(p, "--switch-any", "-s2", list(0, 1))

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