javascript/node/optparse.js
function formatOption(name, helpMsg) {
  var result = [];
  var options = IDENTATION + '--' + name;

  if (options.length > MAX_HELP_POSITION) {
    result.push(options);
    result.push('\n');
    result.push(wrapStr(helpMsg, TOTAL_WIDTH,
        repeatStr(' ', HELP_TEXT_POSITION)).join('\n'));
  } else {
    var spaceCount = HELP_TEXT_POSITION - options.length;
    options += repeatStr(' ', spaceCount) + helpMsg;
    result.push(options.substring(0, TOTAL_WIDTH));
    options = options.substring(TOTAL_WIDTH);
    if (options) {
      result.push('\n');
      result.push(wrapStr(options, TOTAL_WIDTH,
          repeatStr(' ', HELP_TEXT_POSITION)).join('\n'));
    }
  }

  return result.join('');
}
function formatOption(name, helpMsg) {
  var result = [];
  var options = IDENTATION + '--' + name;

  if (options.length > MAX_HELP_POSITION) {
    result.push(options);
    result.push('\n');
    result.push(wrapStr(helpMsg, TOTAL_WIDTH,
        repeatStr(' ', HELP_TEXT_POSITION)).join('\n'));
  } else {
    var spaceCount = HELP_TEXT_POSITION - options.length;
    options += repeatStr(' ', spaceCount) + helpMsg;
    result.push(options.substring(0, TOTAL_WIDTH));
    options = options.substring(TOTAL_WIDTH);
    if (options) {
      result.push('\n');
      result.push(wrapStr(options, TOTAL_WIDTH,
          repeatStr(' ', HELP_TEXT_POSITION)).join('\n'));
    }
  }

  return result.join('');
}
function formatOption ( name , helpMsg ) { var result = [ ] ; var options = IDENTATION + '--' + name ; if ( options . length > MAX_HELP_POSITION ) { result . push ( options ) ; result . push ( '\n' ) ; result . push ( wrapStr ( helpMsg , TOTAL_WIDTH , repeatStr ( ' ' , HELP_TEXT_POSITION ) ) . join ( '\n' ) ) ; } else { var spaceCount = HELP_TEXT_POSITION - options . length ; options += repeatStr ( ' ' , spaceCount ) + helpMsg ; result . push ( options . substring ( 0 , TOTAL_WIDTH ) ) ; options = options . substring ( TOTAL_WIDTH ) ; if ( options ) { result . push ( '\n' ) ; result . push ( wrapStr ( options , TOTAL_WIDTH , repeatStr ( ' ' , HELP_TEXT_POSITION ) ) . join ( '\n' ) ) ; } } return result . join ( '' ) ; }
Formats the help message for a single option.  Will place the option string
and help text on the same line whenever possible.
@param {string} name The name of the option.
@param {string} helpMsg The option's help message.
@return {string} The formatted option.
Formats the help message for a single option . Will place the option string and help text on the same line whenever possible .