Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cryptaliagy/tomlq
A tool for getting data from TOML files on the command line
https://github.com/cryptaliagy/tomlq
cli jq parsing rust toml
Last synced: 5 days ago
JSON representation
A tool for getting data from TOML files on the command line
- Host: GitHub
- URL: https://github.com/cryptaliagy/tomlq
- Owner: cryptaliagy
- License: mit
- Created: 2017-08-26T16:59:41.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-09-06T18:48:12.000Z (4 months ago)
- Last Synced: 2024-12-13T18:09:51.947Z (12 days ago)
- Topics: cli, jq, parsing, rust, toml
- Language: Rust
- Homepage:
- Size: 28.3 KB
- Stars: 59
- Watchers: 4
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tq
This repository was previously available under `cryptaliagy/tq-rs`, and by the crate [`tq-rs`](https://crates.io/crates/tq-rs).
The current iteration of this crate supports both the `tq` and `tomlq` binaries. Wherever possible, `tq` should be preferred, and `tomlq` will be removed from the crate for the `0.2.0` version (scheduled for January 1, 2025).
## Installing
- Using `cargo` (compiles from source): `cargo install tomlq`
- Using `cargo-binstall` (downloads from Github Releases page): `cargo binstall -y tomlq`## Migrating from `tq-rs` crate
The only step that is required to migrate from `tq-rs` to `tomlq` is to change the `cargo install` (or `cargo binstall`) step from referencing `tq-rs` to referencing `tomlq`. The binary has the same name, and the usage is the same.
## Usage
> N.B. Use `tq --help` after installing for more information
### Getting package version from `Cargo.toml`
```
tq -f Cargo.toml 'package.version'
```### Exporting package version as job output in Github Actions
```yaml
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4- name: Install cargo-binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash- name: Install tq
run: cargo binstall -y tomlq- id: get-version
name: Output the current version of the project
run: echo "version=$(tq -f Cargo.toml 'package.version')" >> "$GITHUB_OUTPUT"
```> N.B. See [the release pipeline](./.github/workflows/release.yaml) file for how this job is used.
## Contributions
Contributions are welcome! I just needed this one feature, so I haven't spent any additional time on this. If you have an idea, please feel free to open an issue, if you've implemented some additional features, please feel free to open a PR!
## License
Licensed under the [MIT License](./LICENSE)