cargo-tree icon indicating copy to clipboard operation
cargo-tree copied to clipboard

Option to limit tree depth

Open fenhl opened this issue 6 years ago • 2 comments

For example, --depth=2 to only show my dependencies and their direct dependencies.

fenhl avatar Mar 09 '19 11:03 fenhl

I wanted to have a quick overview of the direct dependencies of my crate without having to open Cargo.toml. Something akin to what was possible with cargo ls.

An option --depth=1 and maybe aliased to --ls would be super useful.

SuperFluffy avatar Mar 21 '19 20:03 SuperFluffy

Yes, please add --depth, and a shortcut -D being equivalent to --depth=1 because this is the most useful. E.g. to find out which crates in your workspace use different versions of the same dep (assuming you run this in your main crate that depends on all other workspace crates):

cargo tree -d --depth=1 | rg '^\w'

Without --depth=1, it shows duplicates among transitive deps, which you have no control over.

Boscop avatar Sep 23 '19 13:09 Boscop