Files
Charlie Root 58f2e80eb5 update
2022-07-31 09:56:11 +00:00

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();