Print verbose help in resin help command

This commit is contained in:
Juan Cruz Viotti 2016-01-12 10:39:29 -04:00
parent 11354de596
commit 78ab2af8ba
4 changed files with 28 additions and 3 deletions

View File

@ -16,7 +16,7 @@ limitations under the License.
*/
(function() {
var _, capitano, columnify, command, general, indent, parse, print;
var _, capitano, columnify, command, general, indent, messages, parse, print;
_ = require('lodash');
@ -26,6 +26,8 @@ limitations under the License.
columnify = require('columnify');
messages = require('../utils/messages');
parse = function(object) {
return _.object(_.map(object, function(item) {
var signature;
@ -55,7 +57,9 @@ limitations under the License.
general = function(params, options, done) {
var commands, groupedCommands;
console.log('Usage: resin [COMMAND] [OPTIONS]\n');
console.log('Primary commands:\n');
console.log(messages.gettingStarted + "\n");
console.log(messages.reachingOut);
console.log('\nPrimary commands:\n');
commands = _.reject(capitano.state.commands, function(command) {
return command.isWildcard();
});

6
build/utils/messages.js Normal file
View File

@ -0,0 +1,6 @@
(function() {
exports.gettingStarted = 'Run the following command to get a device started with Resin.io\n\n $ resin quickstart';
exports.reachingOut = 'If you need help, or just want to say hi, don\'t hesitate in reaching out at:\n\n GitHub: https://github.com/resin-io/resin-cli/issues/new\n Gitter: https://gitter.im/resin-io/chat';
}).call(this);

View File

@ -18,6 +18,7 @@ _ = require('lodash')
_.str = require('underscore.string')
capitano = require('capitano')
columnify = require('columnify')
messages = require('../utils/messages')
parse = (object) ->
return _.object _.map object, (item) ->
@ -46,7 +47,9 @@ print = (data) ->
general = (params, options, done) ->
console.log('Usage: resin [COMMAND] [OPTIONS]\n')
console.log('Primary commands:\n')
console.log("#{messages.gettingStarted}\n")
console.log(messages.reachingOut)
console.log('\nPrimary commands:\n')
# We do not want the wildcard command
# to be printed in the help screen.

12
lib/utils/messages.coffee Normal file
View File

@ -0,0 +1,12 @@
exports.gettingStarted = '''
Run the following command to get a device started with Resin.io
$ resin quickstart
'''
exports.reachingOut = '''
If you need help, or just want to say hi, don't hesitate in reaching out at:
GitHub: https://github.com/resin-io/resin-cli/issues/new
Gitter: https://gitter.im/resin-io/chat
'''