Add command utility similar to the commander package
AlfonzAlfonz opened this issue · comments
Denis Homolík commented
To make creating more complex scripts easier, I propose to add command
utility function for a declarative way of adding branching similar to the commands in commander
package. This would allow each command to be more composable and modular and it wouldn't have to rely on its position in command chain. If this feature would be accepted I'd gladly open PR to implement it.
Example
// if user didn't specify any command, default one will run
command("start", { default: true }, (argv) => { // argv without command name
console.log("starting script");
command("subcommand", () => {
console.log("subcommand script");
});
})
command("deploy", () => {
console.log("deploy script");
});
Anton Medvedev commented
I think this is easily done on user side: npm i zx commander.
Don’t think we need to add it now. Maybe later.