#cargo #cargo-subcommand #cli #dependencies #crates

app cargo-show

Prints package metadata like pip show, apt-cache show, npm view, gem query, etc

13 releases

✓ Uses Rust 2018 edition

0.5.8 Jan 9, 2020
0.5.7 Jul 13, 2019
0.5.5 Aug 30, 2018
0.5.4 Jul 31, 2018
0.2.0 Mar 11, 2016

#32 in Cargo plugins

Download history 36/week @ 2019-10-30 12/week @ 2019-11-06 37/week @ 2019-11-13 36/week @ 2019-11-20 22/week @ 2019-11-27 44/week @ 2019-12-04 165/week @ 2019-12-11 8/week @ 2019-12-18 19/week @ 2019-12-25 14/week @ 2020-01-01 90/week @ 2020-01-08 77/week @ 2020-01-15 23/week @ 2020-01-22 32/week @ 2020-01-29 19/week @ 2020-02-05

152 downloads per month

MIT/Apache

14KB
251 lines

cargo-show

crates.io version Build Status Build status

Prints package metadata like pip show, apt-cache show, npm view, gem query, etc.

To install:

$ 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`)
$

Usage:

$ 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.

To print package metadata:

$ 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

To print 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

To print package metadata and direct dependencies (alternatively use -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)

To print package metadata and direct dependencies as 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
        }
    ]
}

To rename the command if you're used to other package managers:

$ cd /usr/local/bin/  # or someplace in path
$ ln $(which cargo-show) cargo-flizblorp  # needs to be a hardlink
$ cargo --list | grep fliz
    flizblorp

Maintainers

Contributors

Dependencies

~16MB
~350K SLoC