UNPKG

node-getopt

Version:
29 lines (25 loc) 871 B
// 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();