Console commands framework
Library allowing you to define and run your own console commands in no time.
hadron-cli requires node 8 or newer
NOTE: the library is in early stage of development, and it's still not published to npm!
// ./commands/mySimpleCommand.js
export const name = 'myApp:mySimpleCommand';
export const description = 'This command does not do much';
export const action = options => {
console.log('My simple command got following option:', options.foo);
};
export const flags = {
foo: {
alias: 'f',
description: 'Optional option',
},
};
// ./commands.js
export default [
'mySimpleCommand.js',
];
$ hadron myApp:mySimpleCommand -f barbaz
And the result will be:
My simple command got following option: barbaz
Help will be automagically generated:
$ hadron --help
Usage: hadron <command> [options]
Commands:
hadron myApp:mySimpleCommand This command does not do much
Options:
--help Show help [boolean]
--version Show version number [boolean]
$ hadron myApp:mySimpleCommand --help
hadron myApp:mySimpleCommand
This command does not do much
Options:
--help Show help [boolean]
--version Show version number [boolean]
--foo, -f Optional option
- Write tests
- Add command validation
- Add custom help
This library depends on yargs which you may want to use directly.
There are at least 3 options:
- Add an issue, write test(s) for bug you found, write fix that will make your test(s) pass, submit pull request
- Add an issue, write test(s) for bug you found, submit pull request with you test(s)
- Add an issue