Skip to main content

Subcommands

In a Toolchain, you can have as many nested subcommands as you want. Let's take the example from earlier and add a subcommand to it:

toolchain.cli
my-toolchain {
action "echo 'Hello'"

sub child-toolchain { // <- Child name
action "echo Child" // <- Child action
}
}

After reinstalling the script, we can do the following:

Console
$ my-toolchain
Hello
$ my-toolchain child-toolchain
Child

Aliases

Sometimes you want one than more name for your subcommand. For example, the user may want to execute install with a shorthand (like npm supports i for install, eg npm i climat)

To achieve that, you can use the sub modifiers @aliases and @alias:

toolchain.cli
my-toolchain {

@aliases(ct child) // Defines one or more aliases
@alias(cld) // Defines one alias
sub child-toolchain {
action "echo Child"
}

}

After reinstalling the script, we can do the following:

Console
$ my-toolchain child-toolchain
Child
$ my-toolchain child
Child
$ my-toolchain ct
Child
$ my-toolchain cld
Child