improve ghc-info.sh with a show mode

epel9
Jens Petersen 1 year ago
parent 52c1a4cf86
commit beafd4c14d

@ -1,8 +1,12 @@
#!/bin/sh
[ $# -lt 2 ] && echo "Usage: $(basename "$0") GHCVERSION INFOFIELD"
[ $# -lt 1 ] && echo "Usage: $(basename "$0") GHCVERSION INFOFIELD" && exit 1
GHCVER=$1
FIELD=$2
GHCVER="$1"
FIELD="$2"
/usr/bin/ghc-${GHCVER} --info | grep \"$FIELD\" | sed -e 's/.*","\(.*\)")/\1/'
if [ -z "$FIELD" ]; then
/usr/bin/ghc-${GHCVER} --info | sed -e 's/.*(\(".*"\),\(".*"\).*/\1: \2/' -e '/]/d'
else
/usr/bin/ghc-${GHCVER} --info | grep \""$FIELD"\" | sed -e 's/.*","\(.*\)")/\1/'
fi

Loading…
Cancel
Save