index.js
function generateHelp (params) {
  var output = '';

  if (params.usage) {
    var usage = result(params, 'usage');

    output += EOL;
    output += format('Usage: %s', usage);
    output += EOL;
  }

  if (params.desc) {
    var desc = result(params, 'desc');

    output += EOL;
    output += desc;
    output += EOL;
  }

  if (is.object(params.options) && objectLength(params.options) > 0) {
    var options = buildOptions(params.options);

    output += EOL;
    output += 'Options:';
    output += EOL;
    output += EOL;
    output += indent(options, ' ', 2);
    output += EOL;
  }

  if (is.array(params.commands) && params.commands.length > 0) {
    var commands = buildCommands(params.commands);

    output += EOL;
    output += 'Commands:';
    output += EOL;
    output += EOL;
    output += indent(commands, ' ', 2);
    output += EOL;
  }

  output += EOL;

  return indent(output, ' ', 2);
}
function generateHelp (params) {
  var output = '';

  if (params.usage) {
    var usage = result(params, 'usage');

    output += EOL;
    output += format('Usage: %s', usage);
    output += EOL;
  }

  if (params.desc) {
    var desc = result(params, 'desc');

    output += EOL;
    output += desc;
    output += EOL;
  }

  if (is.object(params.options) && objectLength(params.options) > 0) {
    var options = buildOptions(params.options);

    output += EOL;
    output += 'Options:';
    output += EOL;
    output += EOL;
    output += indent(options, ' ', 2);
    output += EOL;
  }

  if (is.array(params.commands) && params.commands.length > 0) {
    var commands = buildCommands(params.commands);

    output += EOL;
    output += 'Commands:';
    output += EOL;
    output += EOL;
    output += indent(commands, ' ', 2);
    output += EOL;
  }

  output += EOL;

  return indent(output, ' ', 2);
}
Generate help