-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix version and help with no gruntfile
- Loading branch information
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* grunt-cli | ||
* http://gruntjs.com/ | ||
* | ||
* Copyright (c) 2016 Tyler Kellen, contributors | ||
* Licensed under the MIT license. | ||
* https://github.com/gruntjs/grunt-init/blob/master/LICENSE-MIT | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Project metadata. | ||
var pkg = require('../package.json'); | ||
|
||
// Display grunt-cli version. | ||
exports.version = function() { | ||
console.log('grunt-cli v' + pkg.version); | ||
}; | ||
|
||
// Show help, then exit with a message and error code. | ||
exports.fatal = function(msg, code) { | ||
exports.helpHeader(); | ||
console.log('Fatal error: ' + msg); | ||
console.log(''); | ||
exports.helpFooter(); | ||
process.exit(code); | ||
}; | ||
|
||
// Show help and exit. | ||
exports.help = function() { | ||
exports.helpHeader(); | ||
exports.helpFooter(); | ||
process.exit(); | ||
}; | ||
|
||
// Help header. | ||
exports.helpHeader = function() { | ||
console.log('grunt-cli: ' + pkg.description + ' (v' + pkg.version + ')'); | ||
console.log(''); | ||
}; | ||
|
||
// Help footer. | ||
exports.helpFooter = function() { | ||
[ | ||
'If you\'re seeing this message, grunt hasn\'t been installed locally to', | ||
'your project. For more information about installing and configuring grunt,', | ||
'please see the Getting Started guide:', | ||
'', | ||
'https://gruntjs.com/getting-started', | ||
].forEach(function(str) { console.log(str); }); | ||
}; |