haampie / libtree

ldd as a tree
MIT License
2.63k stars 60 forks source link

[feature request] Show only direct dependencies #70

Closed mid-kid closed 2 years ago

mid-kid commented 2 years ago

I'd like to list only the direct dependencies of a binary or library. Line readelf -p <file> | grep 'NEEDED' does, but with the prettier output (and more concise command) this tool provides.

This is useful for making sure I get my dependency specifications right for a package.

haampie commented 2 years ago

Hi mid-kid, seems like a reasonable suggestion. Maybe --max-depth 1 or --depth 1?

Would be good to check what common flag names are for those. So far it seems it's not very consistent:

haampie commented 2 years ago

Can you try out the 3.1 release branch, it has --max-depth.

curl -Lfs https://raw.githubusercontent.com/haampie/libtree/release/3.1/libtree.c | ${CC:-cc} -o libtree -x c - -std=c99 -D_FILE_OFFSET_BITS=64