BloombergLP::balcl::CommandLine::parse

Parse the command-line arguments contained in the array starting at the specified argv having the specified argc length. Optionally specify an errorStream to which an appropriate error message is written if parsing fails. If errorStream is not specified, bsl::cerr is used. Return 0 on success, and a non-zero value otherwise. If an argument is not specified on the command-line, then if the Option object configuration for this CommandLine defines an environment variable name and the runtime environment for this application has set that environment variable, then set the option to the value of the environment variable. Otherwise, if an option is not set by the command line, or the environment, set the option using the default value if one has been provided. If the option has not been set by the command line, environment, or by default, hasValue for the option will return false. After a successful call isParsed() and isValid() will both be true, and the information provided by argv can be viewed via the accessors. After an unsuccessful call isParsed() and isValid() will both be false. The behavior is undefined unless isValid() is true and isParsed() is false (i.e. the CommandLine was constructed in a valid state, and parse has not previously been called).

Synopsis

Declared in <balcl_commandline.h>

int
parse(
    int argc,
    char const const* argv[]);