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