Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save zingi/b17eda20cf285208c713b562a214e7e0 to your computer and use it in GitHub Desktop.

Select an option

Save zingi/b17eda20cf285208c713b562a214e7e0 to your computer and use it in GitHub Desktop.
List all direct dependencies of a cargo project.

Cargo Rust Project: list all direct dependencies

Lists all direct dependencies (name+version) of current cargo project.

# ~/.zshrc
alias cargo-list="cargo tree --prefix depth | rg '^1.*' | xargs -I % echo % | sd '^\d' ''"
Example Output
# being in dir with Cargo.toml

❯ cargo-list
bytes v1.0.1
env_logger v0.8.3
futures v0.3.14
log v0.4.14 (*)
prost v0.7.0
quick-error v2.0.0
tokio v1.5.0
tonic v0.4.2
url v2.2.1
uuid v0.8.2
warp v0.3.1
tonic-build v0.4.2

Required Commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment