Remove show command, which is obsolete now
This commit is contained in:
parent
f26830c9b4
commit
032b95aa9b
@ -59,8 +59,6 @@ edo mv shellcheck-latest/shellcheck "$HOME"/.local/bin/shellcheck
|
||||
# check our script for errors
|
||||
edo shellcheck ghcup
|
||||
|
||||
edo ghcup -v show
|
||||
|
||||
edo ghcup -v debug-info
|
||||
|
||||
edo ghcup -v list
|
||||
|
129
ghcup
129
ghcup
@ -185,7 +185,6 @@ FLAGS:
|
||||
|
||||
SUBCOMMANDS:
|
||||
install Install GHC$(${VERBOSE} && printf "\n compile Compile and install GHC from source (UNSTABLE!!!)")
|
||||
show Show current/installed GHC
|
||||
set Set currently active GHC version
|
||||
list Show available GHCs and other tools
|
||||
upgrade Upgrade this script in-place
|
||||
@ -277,24 +276,6 @@ ARGS:
|
||||
exit 1
|
||||
}
|
||||
|
||||
# @FUNCTION: show_usage
|
||||
# @DESCRIPTION:
|
||||
# Print the help message for 'ghcup show' to STDERR
|
||||
# and exit the script with status code 1.
|
||||
show_usage() {
|
||||
(>&2 echo "ghcup-show
|
||||
Show the installed/current GHC versions
|
||||
|
||||
USAGE:
|
||||
${SCRIPT} show [FLAGS]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
-i, --installed Show installed GHC version only
|
||||
")
|
||||
exit 1
|
||||
}
|
||||
|
||||
# @FUNCTION: rm_usage
|
||||
# @DESCRIPTION:
|
||||
# Print the help message for 'ghcup rm' to STDERR
|
||||
@ -1249,6 +1230,37 @@ array_contains() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# @FUNCTION: show_ghc_installed
|
||||
# @DESCRIPTION:
|
||||
# Prints the currently selected GHC only as version string.
|
||||
# @STDOUT: current GHC version
|
||||
show_ghc_installed() {
|
||||
current_ghc="${BIN_LOCATION}/ghc"
|
||||
real_ghc=$(posix_realpath "${current_ghc}")
|
||||
|
||||
if [ -L "${current_ghc}" ] ; then # is symlink
|
||||
if [ -e "${real_ghc}" ] ; then # exists (posix_realpath was called)
|
||||
real_ghc="$(basename "${real_ghc}" | sed 's#ghc-##')"
|
||||
printf "%s" "${real_ghc}"
|
||||
else # is a broken symlink
|
||||
red_message "broken symlink"
|
||||
fi
|
||||
fi
|
||||
|
||||
unset real_ghc current_ghc
|
||||
}
|
||||
|
||||
# @FUNCTION: show_cabal_installed
|
||||
# @DESCRIPTION:
|
||||
# Prints the currently selected cabal only as version string.
|
||||
# @STDOUT: current cabal version
|
||||
show_cabal_installed() {
|
||||
if [ -x "${BIN_LOCATION}/cabal" ] ; then
|
||||
"${BIN_LOCATION}/cabal" --numeric-version
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
############################
|
||||
@ -1415,68 +1427,6 @@ upgrade() {
|
||||
|
||||
|
||||
|
||||
#########################
|
||||
#--[ Subcommand show ]--#
|
||||
#########################
|
||||
|
||||
|
||||
# @FUNCTION: show_ghc
|
||||
# @DESCRIPTION:
|
||||
# Prints the currently installed and selected GHC, in human-friendly
|
||||
# format.
|
||||
show_ghc() {
|
||||
current_ghc=$(show_ghc_installed)
|
||||
|
||||
echo "Installed GHCs:"
|
||||
for i in "${GHC_LOCATION}"/* ; do
|
||||
if [ -e "${i}" ] ; then
|
||||
echo " $(basename "${i}")"
|
||||
else # directory is empty
|
||||
echo " None"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${current_ghc}" ] ; then
|
||||
echo
|
||||
echo "Current GHC"
|
||||
echo " ${current_ghc}"
|
||||
fi
|
||||
|
||||
unset current_ghc i
|
||||
}
|
||||
|
||||
# @FUNCTION: show_ghc_installed
|
||||
# @DESCRIPTION:
|
||||
# Prints the currently selected GHC only as version string.
|
||||
# @STDOUT: current GHC version
|
||||
show_ghc_installed() {
|
||||
current_ghc="${BIN_LOCATION}/ghc"
|
||||
real_ghc=$(posix_realpath "${current_ghc}")
|
||||
|
||||
if [ -L "${current_ghc}" ] ; then # is symlink
|
||||
if [ -e "${real_ghc}" ] ; then # exists (posix_realpath was called)
|
||||
real_ghc="$(basename "${real_ghc}" | sed 's#ghc-##')"
|
||||
printf "%s" "${real_ghc}"
|
||||
else # is a broken symlink
|
||||
red_message "broken symlink"
|
||||
fi
|
||||
fi
|
||||
|
||||
unset real_ghc current_ghc
|
||||
}
|
||||
|
||||
# @FUNCTION: show_cabal_installed
|
||||
# @DESCRIPTION:
|
||||
# Prints the currently selected cabal only as version string.
|
||||
# @STDOUT: current cabal version
|
||||
show_cabal_installed() {
|
||||
if [ -x "${BIN_LOCATION}/cabal" ] ; then
|
||||
"${BIN_LOCATION}/cabal" --numeric-version
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
#--[ Subcommand rm ]--#
|
||||
@ -2004,23 +1954,6 @@ while [ $# -gt 0 ] ; do
|
||||
upgrade "$(dirname "$(posix_realpath "${SOURCE}")")"
|
||||
fi
|
||||
break;;
|
||||
show)
|
||||
SHOW_INSTALLED=false
|
||||
shift 1
|
||||
while [ $# -gt 0 ] ; do
|
||||
case $1 in
|
||||
-h|--help) show_usage;;
|
||||
-i|--installed) SHOW_INSTALLED=true
|
||||
break;;
|
||||
*) show_usage;;
|
||||
esac
|
||||
done
|
||||
if ${SHOW_INSTALLED} ; then
|
||||
show_ghc_installed
|
||||
else
|
||||
show_ghc
|
||||
fi
|
||||
break;;
|
||||
rm)
|
||||
shift 1
|
||||
while [ $# -gt 0 ] ; do
|
||||
|
Loading…
Reference in New Issue
Block a user