UNPKG

node-getopt

Version:
17 lines (15 loc) 729 B
// 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});