mirror of
https://github.com/outbackdingo/control-pane.git
synced 2026-02-07 09:40:26 +00:00
17 lines
729 B
JavaScript
17 lines
729 B
JavaScript
// node-getopt oneline example.
|
|
opt = require('..').create([
|
|
['s' , '' , 'short option.'],
|
|
['' , 'long' , 'long option.'],
|
|
['S' , 'short-with-arg=ARG' , 'option with argument', 'S'],
|
|
['L' , 'long-with-arg=ARG' , 'long option with argument'],
|
|
['' , 'color[=COLOR]' , 'COLOR is optional'],
|
|
['m' , 'multi-with-arg=ARG+' , 'multiple option with argument'],
|
|
['' , 'no-comment'],
|
|
['h' , 'help' , 'display this help'],
|
|
['v' , 'version' , 'show version']
|
|
]) // create Getopt instance
|
|
.bindHelp() // bind option 'help' to default action
|
|
.parseSystem(); // parse command line
|
|
|
|
console.info({argv: opt.argv, options: opt.options});
|