electron-args
cli helper for electron
Features
- Change the argument by the execution environment
- Parses arguments using minimist
- Converts flags to camelCase
- Outputs app version when --version
- Outputs supplied help text when --help
- inspired by meow
Install
$ npm install --save electron-args
Usage
const electron = ;const parseArgs = ; const cli = ; console;console; electronapp;
API
parseArgs(opts, [minimistOptions])
Returns an Object with:
- input (Array) - Non-flag arguments
- flags (Object) - Flags converted to camelCase
- help (string) - The help text used with --help
- showHelp([code=0]) (Function) - Show the help text and exit with code
options
Type: Object
Array
string
Can either be a string/array that is the help
or an options object.
help
Type: string
boolean
The help text you want shown.
Set it to false
to disable it altogether.
version
Type: string
boolean
Default: electron.app.getVersion()
Set a custom version output.
Set it to false to disable it altogether.
argv
Type: Array
Custom arguments object.
minimistOptions
Type: Object
Default: {}
Minimist options.
Keys passed to the minimist default option are decamelized, so you can for example pass in fooBar: 'baz' and have it be the default for the --foo-bar flag.
License
MIT © akameco