Options

@unitybase/base/options~ Options

new Options(commandName, commandDescription, cliopt)

Arguments:
  1. commandName
  2. commandDescription
  3. [cli='ub'] (String)  An executable used to execute a command commandName. For example: ubcli

Methods

add(otherOptions)Options

Add a option(s) definition.
Arguments:
  1. otherOptions (Option|Array.<Option>)

parse(defaultsopt, errorsopt)

Parse a command line & env variables for a options and create a configuration object. Return undefined in case options is not valid or a object with keys - options.long & values
Arguments:
  1. [defaults] (Object)  Override for a command line attributes. If any - this one will be used
  2. [errors] (Array)  If passed will bw filled by a errors in passed parameters

parseVerbose(defaultsopt, outputParsedopt)

In case -help or '-?' command line switch found or passed options not match a options set will output a usage help to console and return undefined, else - return a parsed options
Arguments:
  1. [defaults] (Object)  Override passed parameter values by this one
  2. [outputParsed=false] (Boolean)  output a parsed parameters to a log

usage()

Output a usage info to console