Crates.io | cargo-search2 |
lib.rs | cargo-search2 |
version | 0.2.2 |
source | src |
created_at | 2021-10-04 01:19:52.220815 |
updated_at | 2021-10-11 18:42:22.329741 |
description | cargo search, optimized for CI caching in GitHub Actions and elsewhere |
homepage | |
repository | https://github.com/sunshowers/cargo-search2 |
max_upload_size | |
id | 459876 |
size | 58,440 |
A binary utility that provides a more convenient version of cargo search
.
Grab pre-built binaries for your platform from the releases page.
To grab releases in CI or other automation:
curl -LsSf https://github.com/sunshowers/cargo-search2/releases/latest/download/cargo-search2-{platform}.zip | tar xzf - -C ~/.cargo/bin
Install manually:
cargo install cargo-search2
$ cargo search2 serde
# output:
serde 1.0.130 (hash: blake2b24:2e6117acae4f6f2d2d698c9fc0b43de60ac26556f44ad96b)
$ cargo search2 serde --message-format toml
serde = "1.0.130"
$ cargo search2 serde --message-format json
{"crate-name":"serde","version":"1.0.130","hash":"blake2b24:2e6117acae4f6f2d2d698c9fc0b43de60ac26556f44ad96b"}
# Get an exact version or semver range
$ cargo search2 serde --req '=1.0.120'
serde 1.0.120 (hash: blake2b24:f79131f50c298569f841e47287c3b0a443c29cfda3ffd475)
# Use --cache-version/-c to invalidate caches
$ cargo run -- serde --req '=1.0.120' -c1
serde 1.0.120 (hash: blake2b24:168778241e3b0e96f5547fba1eb4b4b84efa8291c3c14b37)
$ cargo run -- serde --req '=1.0.120' -c2
serde 1.0.120 (hash: blake2b24:344d8a8d08a16dbce8c4e0d90fd6aad513631ca081185ea8)
# Step outputs for GitHub Actions
$ cargo search2 serde --message-format github
::set-output name=crate-name::serde
::set-output name=version::1.0.120
::set-output name=hash::blake2b24:f79131f50c298569f841e47287c3b0a443c29cfda3ffd475
For an example GitHub Action, see .github/workflows/example.yml
.
People sometimes use cargo search
to generate cache keys for tools. This is an easier way to achieve the same goal with a
couple more features.
cargo search2
supports:
--cache-version
optionThe hashes produced by cargo search2
are derived from:
Notably, the operating system and other parts of the environment are not part of the hash.
Within a semver range, the command-line interface is append-only, and hashes stay the same.
Pull requests are welcome! Please follow the code of conduct.
This project is available under the terms of either the Apache 2.0 license or the MIT license.