run-parts-gen-rs/README.md

74 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2017-12-12 18:27:51 +00:00
# run-parts generator
2017-12-11 22:54:31 +00:00
2017-12-12 18:27:51 +00:00
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`