mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 14:37:47 +00:00
Merge pull request #36 from resin-io/feature/standard-version
Implement --version/-v global options. Closes #35
This commit is contained in:
commit
144a155208
@ -7,8 +7,9 @@
|
||||
signature: 'version',
|
||||
description: 'output the version number',
|
||||
help: 'Display the Resin CLI version.',
|
||||
action: function() {
|
||||
return console.log(packageJSON.version);
|
||||
action: function(params, options, done) {
|
||||
console.log(packageJSON.version);
|
||||
return done();
|
||||
}
|
||||
};
|
||||
|
||||
|
13
build/app.js
13
build/app.js
@ -49,6 +49,13 @@
|
||||
alias: 'j'
|
||||
});
|
||||
|
||||
capitano.globalOption({
|
||||
signature: 'version',
|
||||
description: actions.info.version.description,
|
||||
boolean: true,
|
||||
alias: 'v'
|
||||
});
|
||||
|
||||
capitano.globalOption({
|
||||
signature: 'no-color',
|
||||
description: 'disable colour highlighting',
|
||||
@ -161,7 +168,11 @@
|
||||
if (cli.global.project != null) {
|
||||
changeProjectDirectory(cli.global.project);
|
||||
}
|
||||
return capitano.execute(cli, callback);
|
||||
if (cli.global.version) {
|
||||
return actions.info.version.action(null, null, callback);
|
||||
} else {
|
||||
return capitano.execute(cli, callback);
|
||||
}
|
||||
}
|
||||
], errors.handle);
|
||||
|
||||
|
@ -6,5 +6,6 @@ exports.version =
|
||||
help: '''
|
||||
Display the Resin CLI version.
|
||||
'''
|
||||
action: ->
|
||||
action: (params, options, done) ->
|
||||
console.log(packageJSON.version)
|
||||
return done()
|
||||
|
@ -31,6 +31,12 @@ capitano.globalOption
|
||||
description: 'project path'
|
||||
alias: 'j'
|
||||
|
||||
capitano.globalOption
|
||||
signature: 'version'
|
||||
description: actions.info.version.description
|
||||
boolean: true
|
||||
alias: 'v'
|
||||
|
||||
# We don't do anything in response to this options
|
||||
# explicitly. We use InquirerJS to provide CLI widgets,
|
||||
# and that module understands --no-color automatically.
|
||||
@ -134,6 +140,9 @@ async.waterfall([
|
||||
if cli.global.project?
|
||||
changeProjectDirectory(cli.global.project)
|
||||
|
||||
capitano.execute(cli, callback)
|
||||
if cli.global.version
|
||||
actions.info.version.action(null, null, callback)
|
||||
else
|
||||
capitano.execute(cli, callback)
|
||||
|
||||
], errors.handle)
|
||||
|
Loading…
Reference in New Issue
Block a user