sergeant
A CLI solution with simple argument parsing and built in help messages.
API Reference
command
command(name, description, define)
- name: A string. The name of your command
- description: A string. A short description. Optional
- define: A function to define your command
define
define({[option, parameter, command})
It should return a function to call when the command is run. See action
option
option(key, definition)
- key: The name of the option
- definition: An object that defines your option
parameter
parameter(key, definition)
- key: The name of the parameter
- definition: An object that defines your parameter
action
action(args)
It's passed args which are all the options and parameters when run.
definition
{aliases, default, description, multiple, required, type}
- aliases: Optional. An array of strings, each an alias.
- default: Optional. The default value if none is given.
- description: A short description
- multiple: Optional. A boolean. If true then multiple values are accepted.
- required: Optional. A boolean. If true it is required.
- type: A function like Boolean or Number. The value is passed to it to cast it to that type.