15 个版本
0.6.0 | 2024年3月15日 |
---|---|
0.5.9 | 2020年6月9日 |
0.5.8 | 2020年1月9日 |
0.5.7 | 2019年7月13日 |
0.2.0 | 2016年3月11日 |
68 在 Cargo 插件 中
每月170 次下载
15KB
261 行
cargo-show
打印包元数据,如 pip show、apt-cache show、npm view、gem query 等。
安装方法
$ cargo install cargo-show
Updating crates.io index
Installing cargo-show v0.5.7
Downloading crates ...
Downloaded lazy_static v1.4.0
Downloaded strsim v0.9.3
...
Compiling g-k-crates-io-client v0.27.1
Compiling cargo-show v0.5.7
Finished release [optimized] target(s) in 2m 30s
Installing /Users/greg/.cargo/bin/cargo-show
Installed package `cargo-show v0.5.7` (executable `cargo-show`)
$
用法
$ cargo show --help
Usage:
cargo show [options] <crate-name>...
cargo show (-h|--help)
cargo show --version
Options:
--json Print the JSON response.
-L --dependencies Print the crate's dependencies as well.
-h --help Show this help page.
--version Show version.
Display a metadata for a create at crates.io.
打印包元数据
$ cargo show nonexistent-package servo
Error fetching data for nonexistent-package: api errors (status 404 Not Found): Not Found
---
id: servo
name: servo
description: Parked non-servo thing
documentation: None
homepage: None
repository: None
max_version: 0.0.1
downloads: 3137
license: None
created: 2014-12-04T23:41:05.915728+00:00
updated: 2015-12-11T23:55:55.315022+00:00
打印 JSON
$ cargo show --json serde | cut -b '1-120'
{"crate":{"id":"serde","name":"serde","updated_at":"2019-12-16T04:09:49.363249+00:00","versions":[196666,192011,185512,1
打印包元数据和直接依赖(也可使用 -L
)
$ cargo show --dependencies time
---
id: time
name: time
description: Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std].
documentation: None
homepage: None
repository: https://github.com/time-rs/time
max_version: 0.2.2
downloads: 10771986
license: None
created: 2014-11-13T06:52:51.369245+00:00
updated: 2020-01-08T03:27:19.481880+00:00
dependencies:
serde ^1 (opt)
以 JSON 格式打印包元数据和直接依赖
$ cargo show --dependencies --json time | python -m json.tool | head -n25
{
"dependencies": [
{
"crate_id": "serde",
"default_features": false,
"downloads": 0,
"features": [
"derive",
"alloc"
],
"id": 1078018,
"kind": "normal",
"optional": true,
"req": "^1",
"target": null,
"version_id": 202181
}
]
}
如果你习惯于其他包管理器,可以重命名命令
$ cd /usr/local/bin/ # or someplace in path
$ ln $(which cargo-show) cargo-flizblorp # needs to be a hardlink
$ cargo --list | grep fliz
flizblorp
维护者
贡献者
依赖
~14–23MB
~393K SLoC