lib/running.js
function generateHelp(flags) {
  var max = 0;
  for (var group in flags) {
    for (var i = 0; i < flags[group].length; i++) {
      var n = 2; // '  '
      if (flags[group][i].longFlag) {
        n += 2; // '--'
        n += flags[group][i].longFlag.length;
      }
      if (flags[group][i].longFlag && flags[group][i].shortFlag) {
        n += 2; // ', '
      }
      if (flags[group][i].shortFlag) {
        n += 1; // '-'
        n += flags[group][i].shortFlag.length;
      }

      if (n > max) {
        max = n;
      }
    }
  }

  console.log('node-async-testing');
  console.log('');

  for (var group in flags) {
    console.log(group+':');
    for (var i = 0; i < flags[group].length; i++) {
      var s = '  ';
      if (flags[group][i].longFlag) {
        s += '--' + flags[group][i].longFlag;
      }
      if (flags[group][i].longFlag && flags[group][i].shortFlag) {
        s += ', ';
      }
      if (flags[group][i].shortFlag) {
        for(var j = s.length+flags[group][i].shortFlag.length; j < max; j++) {
          s += ' ';
        }
        s += '-' + flags[group][i].shortFlag;
      }
      if (flags[group][i].takesValue) {
        s += ' <'+flags[group][i].takesValue+'>';
      }
      console.log(
        s +
        ': ' +
        flags[group][i].description +
        (flags[group][i].options ? ' ('+flags[group][i].options.join(', ')+')' : '')
        );
    }
    console.log('');
  }
  console.log('Any other arguments are interpreted as files to run');
}
function generateHelp(flags) {
  var max = 0;
  for (var group in flags) {
    for (var i = 0; i < flags[group].length; i++) {
      var n = 2; // '  '
      if (flags[group][i].longFlag) {
        n += 2; // '--'
        n += flags[group][i].longFlag.length;
      }
      if (flags[group][i].longFlag && flags[group][i].shortFlag) {
        n += 2; // ', '
      }
      if (flags[group][i].shortFlag) {
        n += 1; // '-'
        n += flags[group][i].shortFlag.length;
      }

      if (n > max) {
        max = n;
      }
    }
  }

  console.log('node-async-testing');
  console.log('');

  for (var group in flags) {
    console.log(group+':');
    for (var i = 0; i < flags[group].length; i++) {
      var s = '  ';
      if (flags[group][i].longFlag) {
        s += '--' + flags[group][i].longFlag;
      }
      if (flags[group][i].longFlag && flags[group][i].shortFlag) {
        s += ', ';
      }
      if (flags[group][i].shortFlag) {
        for(var j = s.length+flags[group][i].shortFlag.length; j < max; j++) {
          s += ' ';
        }
        s += '-' + flags[group][i].shortFlag;
      }
      if (flags[group][i].takesValue) {
        s += ' <'+flags[group][i].takesValue+'>';
      }
      console.log(
        s +
        ': ' +
        flags[group][i].description +
        (flags[group][i].options ? ' ('+flags[group][i].options.join(', ')+')' : '')
        );
    }
    console.log('');
  }
  console.log('Any other arguments are interpreted as files to run');
}
function generateHelp ( flags ) { var max = 0 ; for ( var group in flags ) { for ( var i = 0 ; i < flags [ group ] . length ; i ++ ) { var n = 2 ; // '  ' if ( flags [ group ] [ i ] . longFlag ) { n += 2 ; // '--' n += flags [ group ] [ i ] . longFlag . length ; } if ( flags [ group ] [ i ] . longFlag && flags [ group ] [ i ] . shortFlag ) { n += 2 ; // ', ' } if ( flags [ group ] [ i ] . shortFlag ) { n += 1 ; // '-' n += flags [ group ] [ i ] . shortFlag . length ; } if ( n > max ) { max = n ; } } } console . log ( 'node-async-testing' ) ; console . log ( '' ) ; for ( var group in flags ) { console . log ( group + ':' ) ; for ( var i = 0 ; i < flags [ group ] . length ; i ++ ) { var s = '  ' ; if ( flags [ group ] [ i ] . longFlag ) { s += '--' + flags [ group ] [ i ] . longFlag ; } if ( flags [ group ] [ i ] . longFlag && flags [ group ] [ i ] . shortFlag ) { s += ', ' ; } if ( flags [ group ] [ i ] . shortFlag ) { for ( var j = s . length + flags [ group ] [ i ] . shortFlag . length ; j < max ; j ++ ) { s += ' ' ; } s += '-' + flags [ group ] [ i ] . shortFlag ; } if ( flags [ group ] [ i ] . takesValue ) { s += ' <' + flags [ group ] [ i ] . takesValue + '>' ; } console . log ( s + ': ' + flags [ group ] [ i ] . description + ( flags [ group ] [ i ] . options ? ' (' + flags [ group ] [ i ] . options . join ( ', ' ) + ')' : '' ) ) ; } console . log ( '' ) ; } console . log ( 'Any other arguments are interpreted as files to run' ) ; }
creates the help message for running this from the command line
creates the help message for running this from the command line