opt_get_verb {optigrab} | R Documentation |
Get verb from the command line
Description
Return the verb for the application. The verb is the first argument that is not part of an option.
Usage
opt_get_verb(opts = commandArgs())
Arguments
opts |
character; Vector from which to parse options
(default: |
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
opt_get_verb() # commandArgs()