mirror of https://github.com/ericonr/dotfiles.git
Add depgraph command.
Visualize program dependencies with PNGs generated by dot.
This commit is contained in:
parent
8089adf276
commit
a29a58b46e
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
args=
|
||||
package=
|
||||
open_after=
|
||||
|
||||
print_help() {
|
||||
cat << EOF
|
||||
Usage: $0 [flags] package
|
||||
Flags:
|
||||
-o: open result in imv
|
||||
-f, -g, -m: flags passed to xbps-dgraph
|
||||
EOF
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-g|-f|-m) args="$args $1";;
|
||||
-o) open_after=1;;
|
||||
*) package="$1";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$package" ]; then
|
||||
print_help
|
||||
fi
|
||||
|
||||
echo "Generating graph for $package"
|
||||
|
||||
if [ "$open_after" ]; then
|
||||
xbps-dgraph $args $package | dot -Tpng | imv -
|
||||
else
|
||||
xbps-dgraph $args $package | dot -Tpng -o "${package}.png"
|
||||
fi
|
Loading…
Reference in New Issue