Tweak ghcup upgrade
1. add --inplace flag 2. by default install into BIN_LOCATION
This commit is contained in:
parent
ae99de5876
commit
36e8389bb0
13
ghcup
13
ghcup
@ -269,10 +269,12 @@ USAGE:
|
|||||||
${SCRIPT} upgrade [FLAGS] [TARGET-LOCATION]
|
${SCRIPT} upgrade [FLAGS] [TARGET-LOCATION]
|
||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
|
-i, --inplace Update this script in-place (wherever it's at)
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
|
|
||||||
ARGS:
|
ARGS:
|
||||||
[TARGET-LOCATION] Where to place the updated script (defaults to directory of the script).
|
[TARGET-LOCATION] Where to place the updated script (defaults to ${BIN_LOCATION}).
|
||||||
|
This is ignored if --inplace is issued as well.
|
||||||
")
|
")
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -1885,18 +1887,23 @@ while [ $# -gt 0 ] ; do
|
|||||||
|
|
||||||
break;;
|
break;;
|
||||||
upgrade)
|
upgrade)
|
||||||
|
IN_PLACE=false
|
||||||
shift 1
|
shift 1
|
||||||
while [ $# -gt 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--help) upgrade_usage;;
|
-h|--help) upgrade_usage;;
|
||||||
|
-i|--inplace) IN_PLACE=true
|
||||||
|
shift 1 ;;
|
||||||
*) TARGET_LOCATION=$1
|
*) TARGET_LOCATION=$1
|
||||||
break;;
|
break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ -n "${TARGET_LOCATION}" ] ; then
|
if ${IN_PLACE} ; then
|
||||||
|
upgrade "$(dirname "$(posix_realpath "${SOURCE}")")"
|
||||||
|
elif [ -n "${TARGET_LOCATION}" ] ; then
|
||||||
upgrade "${TARGET_LOCATION}"
|
upgrade "${TARGET_LOCATION}"
|
||||||
else
|
else
|
||||||
upgrade "$(dirname "$(posix_realpath "${SOURCE}")")"
|
upgrade "${BIN_LOCATION}"
|
||||||
fi
|
fi
|
||||||
break;;
|
break;;
|
||||||
show)
|
show)
|
||||||
|
Loading…
Reference in New Issue
Block a user