mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 18:56:25 +00:00
Merge pull request #376 from resin-io/feature/global-help-option
Add global --help option
This commit is contained in:
commit
d81fbad6f3
12
build/app.js
12
build/app.js
@ -53,6 +53,12 @@ limitations under the License.
|
||||
}
|
||||
});
|
||||
|
||||
capitano.globalOption({
|
||||
signature: 'help',
|
||||
boolean: true,
|
||||
alias: 'h'
|
||||
});
|
||||
|
||||
capitano.command(actions.info.version);
|
||||
|
||||
capitano.command(actions.help.help);
|
||||
@ -143,6 +149,12 @@ limitations under the License.
|
||||
var cli;
|
||||
cli = capitano.parse(process.argv);
|
||||
return events.trackCommand(cli).then(function() {
|
||||
var ref, ref1;
|
||||
if ((ref = cli.global) != null ? ref.help : void 0) {
|
||||
return capitano.executeAsync({
|
||||
command: "help " + ((ref1 = cli.command) != null ? ref1 : '')
|
||||
});
|
||||
}
|
||||
return capitano.executeAsync(cli);
|
||||
});
|
||||
})["catch"](errors.handle);
|
||||
|
@ -41,6 +41,11 @@ capitano.command
|
||||
action: ->
|
||||
capitano.execute(command: 'help')
|
||||
|
||||
capitano.globalOption
|
||||
signature: 'help'
|
||||
boolean: true
|
||||
alias: 'h'
|
||||
|
||||
# ---------- Info Module ----------
|
||||
capitano.command(actions.info.version)
|
||||
|
||||
@ -119,6 +124,8 @@ plugins.register(/^resin-plugin-(.+)$/).then ->
|
||||
cli = capitano.parse(process.argv)
|
||||
|
||||
events.trackCommand(cli).then ->
|
||||
if cli.global?.help
|
||||
return capitano.executeAsync(command: "help #{cli.command ? ''}")
|
||||
capitano.executeAsync(cli)
|
||||
|
||||
.catch(errors.handle)
|
||||
|
Loading…
Reference in New Issue
Block a user