Little Rust tool that generates scripts for run-parts from a central config file
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

# run-parts generator
5 years ago
A little tool to write scripts to folders for usage with run-parts,
based on definitions in a toml file. Written mostly for educational purposes,
it would probably be easier to write the scripts themselves,
than to take care of a config file where they are defined.
### Usage:
Assuming you have a config file `config.toml` in the directory you are currently in,
generating the scripts from it is as easy as running
```bash
run-parts-gen-rs config.toml
```
If something doesn't work, you should see output complaining.
If something went wrong but you see no output, try adding `-v` to the command,
and again if that didn't help (but not more than four `-v`'s).
This will enable more verbose logging.
#### Config file:
There is an example config file in this repository, called config.example.toml,
you can orient yourself on that.
The most basic valid config file only contains the line
```toml
reduce_to_config = true
```
To then add actual functionality, add a folder block:
```toml
[[folders]]
path = ''
```
And to that folder block add a script block for each script you want to add to that folder:
```toml
[[folders.scripts]]
name = ''
commands = ['']
```
You can add as many folder blocks as you want, and to those folder blocks as many script blocks as you want.
This should be enough to get you going, gl hf!
### Dependencies:
You're going to need ..
- cargo
- ~/.cargo/bin/ in your $PATH
- Internet access
I'll assume the third thing is already present, to get the first two, head over to [rustup](https://rustup.rs).
### Installation
Clone the source code to rpg-rs
```bash
git clone https://git.jcg.re/jcgruenhage/run-parts-gen-rs.git rpg-rs
```
Enter the just cloned source directory
```bash
cd rpg-rs
```
Compile a release build
```bash
cargo install
```
You should now have the binary in `~/.cargo/bin`