tasks/usage.js
function formatUsage(grunt, usageHeader, usageHelp) {
  var usageString = '',
      reUsage = [new RegExp('\\[-(.+?)\\]', 'g'), '[$1]'],
      reTasks = [new RegExp('^[ ]{2}-([^\\s]*)', 'mg'), '  $1 '];

  usageString += usageHeader;

  usageHelp = usageHelp.replace(reUsage[0], reUsage[1]);
  usageHelp = usageHelp.replace(reTasks[0], reTasks[1]);

  usageString += usageHelp;

  // One final pass to ensure linebreak normalization.
  return grunt.util.normalizelf(usageString);
}
function formatUsage(grunt, usageHeader, usageHelp) {
  var usageString = '',
      reUsage = [new RegExp('\\[-(.+?)\\]', 'g'), '[$1]'],
      reTasks = [new RegExp('^[ ]{2}-([^\\s]*)', 'mg'), '  $1 '];

  usageString += usageHeader;

  usageHelp = usageHelp.replace(reUsage[0], reUsage[1]);
  usageHelp = usageHelp.replace(reTasks[0], reTasks[1]);

  usageString += usageHelp;

  // One final pass to ensure linebreak normalization.
  return grunt.util.normalizelf(usageString);
}
function formatUsage ( grunt , usageHeader , usageHelp ) { var usageString = '' , reUsage = [ new RegExp ( '\\[-(.+?)\\]' , 'g' ) , '[$1]' ] , reTasks = [ new RegExp ( '^[ ]{2}-([^\\s]*)' , 'mg' ) , '  $1 ' ] ; usageString += usageHeader ; usageHelp = usageHelp . replace ( reUsage [ 0 ] , reUsage [ 1 ] ) ; usageHelp = usageHelp . replace ( reTasks [ 0 ] , reTasks [ 1 ] ) ; usageString += usageHelp ; // One final pass to ensure linebreak normalization. return grunt . util . normalizelf ( usageString ) ; }
Performs a final processing run on the usage string and then returns it.

The most major modification we do is removing the dash at the start of
the Grunt task names. This is a hack to work around the fact that
argparse won't show a valid usage string at the top of the help dialog
unless we use optional arguments.

Optional arguments are always indicated with one or more preceding dashes,
so we add them to get argparse to do what we want, and then remove them
just before output. They can be safely filtered out.

@param {Object} grunt The Grunt object
@param {String} usageHeader The formatted usage header string
@param {String} usageHelp The output from Node argparse
@returns {String} The processed string
Performs a final processing run on the usage string and then returns it .