Cargo plugin to easily query information from Cargo.toml files
Overview
This plugin helps querying information from a Cargo.toml file and can be used in shell scripts or CI/CD pipelines. The plugin accepts only one flag at a time and returns a single string with the requested value. Some queries like eq. keywords or authors return multiple values which get separated by line breaks (each value on a new line).
This plugin is inspired by cargo-edit and presents itself as a lightweight wrapper around cargo_toml
Contribution
Thanks for your interest - we gratefully welcome contributions.
Questions can be asked in issues. To help us help you get pull requests merged quickly and smoothly, open an issue before submitted large changes. Please keep the contents of pull requests and commits short. Commit messages should include the intent of the commit. cargo-get uses rustfmt for formatting and clippy for linting.
Installation
Pre-built Binaries
- Download the binary for your CPU architecture from the GitHub latest release.
- Make the binary executable using
chmod +x - Place the binary in your
$PATHand rename it tocargo-get.
Cargo
Ensure that you have a fairly recent version of rust/cargo installed.
$ cargo install cargo-get
(Please check cargo's documentation to learn how cargo install works and how to set up your system so it finds binaries installed by cargo.)
Examples
All Options
)
| | | |
| | | | )
Get Version
Now it is also easy to run commands like:
Get keywords
Custom delimiter
# Use one of Tab, CR, LF, CRLF or a custom string.
;
Optional entry point
# Full path
# Directory
# Current directory
GitHub Actions
Package name
- name: Get package name
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.name
Package author
- name: Get package author
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.authors