mirror of https://github.com/ericonr/dotfiles.git
40 lines
552 B
Bash
Executable File
40 lines
552 B
Bash
Executable File
#!/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, -R, -M: flags passed to xbps-dgraph
|
|
EOF
|
|
|
|
exit 1
|
|
}
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case $1 in
|
|
-g|-f|-m|-R|-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
|