6 releases
new 0.1.5 | Feb 1, 2025 |
---|---|
0.1.4 | Jan 31, 2025 |
#1127 in Command line utilities
175 downloads per month
9KB
95 lines
cchain
Overview
cchain
is a command line tool designed to execute a series of commands based on a configuration file. It supports retrying commands if they fail, with a specified number of attempts.
Features
- Execute commands with specified arguments.
- Retry commands on failure with configurable retry limits.
- Simple configuration using JSON files.
- Logging of command execution and retries.
Installation
To install cchain
, clone the repository and build it using Cargo:
git clone https://github.com/yourusername/cchain.git
cd cchain
cargo build --release
Usage
Create a JSON configuration file with the commands you want to execute. Example configuration:
[
{
"command": "echo",
"arguments": ["Hello, world!"],
"retry": 3
},
{
"command": "ls",
"arguments": ["-la"],
"retry": 1
}
]
Additionally, if you do not specify a configuration file, cchain
will list all available configuration files in the current working directory that start with cchain_
and have a .json
extension. You can then select the desired configuration file by entering the corresponding number.
Example:
./cchain
This will prompt you to select from the available configuration files in the current directory.
Run cchain
with the path to your configuration file:
./cchain --configurations path/to/configurations.json
To generate a template configuration file, use the --generate
flag:
./cchain --generate
License
This project is licensed under the MIT License.
Dependencies
~2–13MB
~92K SLoC