2022-12-18 22:46:16 -07:00
|
|
|
|
`tomcat` – a minimal [TOML](https://toml.io) parser for the command line.
|
2022-11-21 21:10:24 -07:00
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
|
|
### From Source
|
|
|
|
|
|
2022-12-18 22:46:16 -07:00
|
|
|
|
1. Run `cargo --install --git https://git.tebibyte.media/emma/tomcat.git`
|
|
|
|
|
2. ???
|
|
|
|
|
3. Profit
|
|
|
|
|
|
2022-12-19 12:01:28 -07:00
|
|
|
|
Also make sure that your cargo `bin` directory (by default in
|
|
|
|
|
`"$CARGO_HOME"/bin`) is in your `$PATH`; I recommend symlinking the folder to
|
|
|
|
|
`"$HOME/.local/bin` and adding that to your user `$PATH`.
|
|
|
|
|
|
2022-12-18 22:46:16 -07:00
|
|
|
|
## Usage
|
|
|
|
|
|
2022-12-19 12:01:28 -07:00
|
|
|
|
Assuming the TOML file being parsed is `file.toml`:
|
|
|
|
|
|
|
|
|
|
To get the value of top-level key `notable`:
|
|
|
|
|
|
|
|
|
|
`tomcat notable file.toml`
|
|
|
|
|
|
|
|
|
|
To get the value of `key` from the `main` table:
|
2022-12-18 22:46:16 -07:00
|
|
|
|
|
|
|
|
|
`tomcat main.key file.toml`
|
|
|
|
|
|
2022-12-19 12:01:28 -07:00
|
|
|
|
To get the value of `key` from the subtable `subtab` in table `main`:
|
2022-12-18 22:46:16 -07:00
|
|
|
|
|
2022-12-19 12:01:28 -07:00
|
|
|
|
`tomcat main.subtab.key file.toml`
|
2022-12-18 22:46:16 -07:00
|
|
|
|
|
2022-12-19 12:01:28 -07:00
|
|
|
|
To get the value of index `3` in array `arr` in table `main`:
|
2022-12-18 22:46:16 -07:00
|
|
|
|
|
|
|
|
|
`tomcat main.arr[3] file.toml`
|