Closed pravic closed 6 years ago
I'm open to it.
Do you have an idea what the output might look like? Would we just fetch direct dependents (A > B) or indirect dependents (A > B > C) too? Something like cargo-tree?
The direct ones would be enough for me.
But we can add an additional way to display indirect dependencies as well.
As for the output format - I have no idea, need to check what other addons do (cargo modules, tree, etc.)
We can start with cargo show --dependents
which would output the direct dependencies like cargo tree i.e. newline delimited with indirect dependents indented with two spaces per layer.
possible example:
cargo show --dependents servo ripgrep
---
id: servo
name: servo
description: Parked non-servo thing
documentation: None
homepage: None
repository: None
max_version: 0.0.1
downloads: 1264
license: None
created: 2014-12-04T23:41:05.915728+00:00
updated: 2015-12-11T23:55:55.315022+00:00
dependencies:
---
id: ripgrep
name: ripgrep
description: Line oriented search tool using Rust's regex library. Combines the raw
performance of grep with the usability of the silver searcher.
documentation: https://github.com/BurntSushi/ripgrep
homepage: https://github.com/BurntSushi/ripgrep
repository: https://github.com/BurntSushi/ripgrep
max_version: 0.8.1
downloads: 42018
license: None
created: 2016-09-14T01:16:59.748952+00:00
updated: 2018-02-21T17:39:32.060097+00:00
dependencies:
atty ^0.2.2
bytecount ^0.3.1
...
We should already have the direct dependents in the crate deps vector: https://github.com/g-k/g-k-crates-io-client/blob/master/lib.rs#L67 but will need to verify that.
Not sure if or when I'll have time to work on this, but PRs are welcome.
~Too noisy, imho~ Sorry, I didn't know that cargo show
supports multiple arguments and misread your example.
And yes, as for the dependencies, I'd prefer something similar to cargo tree
(at least, in non-verbose mode):
$ cargo show krate --dependents
...
dependencies:
├── lazy_static v1.0.1
└── libc v0.2.42
Sometimes I need to view dependencies of some crate and I think that it would be easier to add this feature (via a command line option) here rather than creating a separate tool for that.
What do you think?