opt_get_verb: Get verb from the command line

Description Usage Arguments Details Value Assumptions See Also Examples

Description

Return the verb for the application. The verb is the first argument that is not part of an option.

Usage

1

Arguments

opts

character; Vector from which to parse options (default: commandArgs() )

Details

Some applications such as git support command verbs, e.g. push, fetch, etc. These style arguments can be retrieved by opt_get_verb.

opt_get_verb look for the first unaccounted for options (after --args). The number of options needed by each flags is determined by and saved by calls to opt_get(). See the details to see how n is automatically determined. When not explicitly defined the number of options needed by each flag is 1. Becasue of this, it convention to call opt_get_verb after all opt_get calls. For most simple applications, it likely doesn't matter.

Value

character of length 1; the verb found from the command-line. NA if a verb cannot be identified.

Assumptions

opt_get_verb assumes any flags occurring before the verb have exactly 1 value. A command line such as "> myscript –verbose verb" will be misparsed; the code will assume that "verb" is the value of the flag "–verbose"

See Also

Examples

1
2
  opt_get_verb()  # commandArgs()
  

Example output

[1] "/usr/lib/R/bin/exec/R"

optigrab documentation built on May 2, 2019, 2:10 a.m.