zxc
is a directory-oriented command runner.
This means it is able to run commands defined by YAML files.
pre-commit tool is used.
To install pre-commit hooks:
pre-commit install
To run pre-commit hooks:
pre-commit run -a
Definition files are searched for in two places:
- local - from CWD.
- external - from
$HOME/.zxc/<mirrored CWD path>
. E.g., if CWD is/opt/app/
then$HOME/.zxc/opt/app/
should be used.
Following file names are allowed:
.zxc.yml
.zxc.yaml
zxc.yml
zxc.yaml
It's expected that at least one definition file is found. It's not allowed to have multiple definition files in one directory.
External definition file takes precedence. This might cause command to be overwritten if defined in both files.
Following fields are used to define a command:
- command name is used as a key
command
- command to rundescription
- optional command descriptionarguments
- optional arguments
Following fields are used to define an argument:
- argument name is used as a key
description
- optional argument descriptiondefault
- optional default value - if not defined, then argument is requiredlong
- optional long version of parameter, argument name is used by defaultshort
- optional short version of parameter, must be single character long
Jinja is used as a template engine.
command
field can contain double curly braces to provide arguments to the command.
Simple definition file:
greet:
command: echo "Hello {{ name }}!"
description: Greets specified person.
arguments:
name:
description: |-
Name to greet.
default: User
long: name
short: n
Use following command to print Hello John!
:
zxc greet --name John