If you are familiar with the scripts section of yarn or npm then you are familiar with what this is trying to achieve but without the baggage of requiring node. A json config file that specifies what commands should be run. This can be used like a makefile that can also do deployment or linting or set environment variables before running commands. The benefit of this over bash scripts is readability.
This command will look for commands in the following files in the order shown:
./run.json
${HOME}/run.json
/etc/run/run.json
A run.json file with all potential sections should looks like this:
{
"command": [{
"name": "default",
"value": "echo \"This is the default command\"",
"env": [{
"name": "local_env",
"value": "true"
}],
"path": ["/usr/sbin"]
}],
"env": [{
"name": "global_env",
"value": "true"
}],
"path": [
"/usr/local/bin"
]
}
Run the first default command found
./run.sh
Run the default command found in "${HOME}/run.json
./run.sh --user
Create all the run.json files
./run.sh -i
Create the run.json in the working directory
./run.sh -wd
List all available commands
./run.sh -l
List the globally available commands
./run.sh -l -g
Generate the autocompletion file for all command
./run.sh -c
Generate the autocompletion file for a custom command
./run.sh -c -f x.json
Override an environment variable in run.json from cli
./run.sh -e x=y
The environment variables can be accessed in the normal bash way within the commands. Variables can be accessed within the commands but are not set in the environment that the command is run in. I can't think of a use case for variables right now but I'm certain there will be some. The variable syntax is very similar to jinja2 style templating. It will be possible to override environment variables or variables from the command line.
- Clone repository
- Configure the hooks
git config core.hooksPath .githooks
- Install the development dependencies:
jq
shellcheck
https://github.com/sstephenson/bats.git