Skip to content
Myr

custom-help

This file

Path

examples/custom-help

32 lines · 600 bytes

Last changed by

fix .usage() when args are present. Closes #106TJ Holowaychukbefore adoptione52a321

History of this file

Take it

Added support for custom --help outputTj Holowaychukbefore adoptionda13783

lines 1–31why, one step back
1#!/usr/bin/env node
23/**4 * Module dependencies.5 */67var program = require('../');89function list(val) {10 return val.split(',').map(Number);11}1213program14 .version('0.0.1')15 .option('-f, --foo', 'enable some foo')16 .option('-b, --bar', 'enable some bar')17 .option('-B, --baz', 'enable some baz');1819// must be before .parse() since20// node's emit() is immediate2122program.on('--help', function(){23 console.log(' Examples:');24 console.log('');25 console.log(' $ custom-help --help');26 console.log(' $ custom-help -h');27 console.log('');28});2930program.parse(process.argv);31

fix .usage() when args are present. Closes #106TJ Holowaychukbefore adoptione52a321

line 32why, one step back
32program.help();