mirror of
https://github.com/outbackdingo/control-pane.git
synced 2026-02-07 09:40:26 +00:00
29 lines
871 B
JavaScript
29 lines
871 B
JavaScript
// examples/help.js
|
|
// Works with help
|
|
Getopt = require('..');
|
|
|
|
getopt = new Getopt([
|
|
['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']
|
|
]);
|
|
|
|
// Use custom help template instead of default help
|
|
// [[OPTIONS]] is the placeholder for options list
|
|
getopt.setHelp(
|
|
"Usage: node help.js [OPTION]\n" +
|
|
"node-getopt help demo.\n" +
|
|
"\n" +
|
|
"[[OPTIONS]]\n" +
|
|
"\n" +
|
|
"Installation: npm install node-getopt\n" +
|
|
"Respository: https://github.com/jiangmiao/node-getopt"
|
|
);
|
|
|
|
getopt.showHelp();
|