google / zx

A tool for writing better scripts

Home Page:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add command utility similar to the commander package

AlfonzAlfonz opened this issue · comments

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.


// 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");

I think this is easily done on user side: npm i zx commander.

Don’t think we need to add it now. Maybe later.

ezoic increase your site revenue