javascript/node/optparse.js
function formatHelpMsg(usage, options) {
  var prog = path.basename(
      process.argv[0]) + ' ' + path.basename(process.argv[1]);
  var help = [
    usage.replace(/\$0\b/g, prog),
    '',
    'Options:',
    formatOption('help', 'Show this message and exit')
  ];

  Object.keys(options).sort().forEach(function(key) {
    help.push(formatOption(key, options[key].help));
  });

  help.push('');

  return help.join('\n');
}
function formatHelpMsg(usage, options) {
  var prog = path.basename(
      process.argv[0]) + ' ' + path.basename(process.argv[1]);
  var help = [
    usage.replace(/\$0\b/g, prog),
    '',
    'Options:',
    formatOption('help', 'Show this message and exit')
  ];

  Object.keys(options).sort().forEach(function(key) {
    help.push(formatOption(key, options[key].help));
  });

  help.push('');

  return help.join('\n');
}
function formatHelpMsg ( usage , options ) { var prog = path . basename ( process . argv [ 0 ] ) + ' ' + path . basename ( process . argv [ 1 ] ) ; var help = [ usage . replace ( / \$0\b / g , prog ) , '' , 'Options:' , formatOption ( 'help' , 'Show this message and exit' ) ] ; Object . keys ( options ) . sort ( ) . forEach ( function ( key ) { help . push ( formatOption ( key , options [ key ] . help ) ) ; } ) ; help . push ( '' ) ; return help . join ( '\n' ) ; }
Formats a help message for the given parser.
@param {string} usage The usage string. All occurences of "$0" will be
replaced with the name of the current program.
@param {!Object.<!Option>} options The options to format.
@return {string} The formatted help message.
Formats a help message for the given parser .