Represents a program and all it's arguments and subcommands.

new Program(npm_package_json_loc: string)
License: MPL-2.0
Parameters
npm_package_json_loc (string) The filepath to your project's package.json file.
Instance Members
has_subcommands
has_arguments
max_arg_length
set_name(str)
set_description(str)
set_description_extended(str)
argument(name, description, default_value, type)
subcommand(name, description)
parse(args)
write_version_exit()
write_help_exit()

Represents a single command-line argument. You probably won't interact with this class directly - it's safe to ignore it until you need it.

new Argument(name: any, description: any, default_value: any, type: any)
Parameters
name (any)
description (any)
default_value (any)
type (any)
Instance Members
option_name
multiple_values
type(type)
value_parser(func)
parse_value(val)

Represents a subcommand on the CLI. Example call on the command line:

path/to/file.mjs foo --bar baz

In the above, "foo" (without quotes) is the subcommand. Arguments can be attached either to the global Program instance, or to a specific Subcommand instance.

new Subcommand(name: string, description: string)
Parameters
name (string) The name of the subcommand
description (string) The human-readable description of the subcommand (displayed in the help text)
Instance Members
has_arguments
argument(name, description, default_value, type)