Added 'dnvm alias -d' and deprecated 'dnvm unalias'
This commit is contained in:
Родитель
cc9db92133
Коммит
16530beba7
19
src/dnvm.sh
19
src/dnvm.sh
|
@ -483,7 +483,7 @@ __dnvm_help() {
|
||||||
echo " <alias> the name of the alias to set"
|
echo " <alias> the name of the alias to set"
|
||||||
echo " <semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
|
echo " <semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
|
||||||
echo ""
|
echo ""
|
||||||
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME unalias <alias> ${RCol}"
|
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME alias [-d|-delete] <alias> ${RCol}"
|
||||||
echo " remove the specified alias"
|
echo " remove the specified alias"
|
||||||
echo ""
|
echo ""
|
||||||
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME [help|-h|-help|--help] ${RCol}"
|
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME [help|-h|-help|--help] ${RCol}"
|
||||||
|
@ -876,6 +876,16 @@ dnvm()
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
if [[ $1 == "-d" || $1 == "-delete" ]]; then
|
||||||
|
local name=$2
|
||||||
|
local aliasPath="$_DNVM_ALIAS_DIR/$name.alias"
|
||||||
|
[[ ! -e "$aliasPath" ]] && echo "Cannot remove alias, '$name' is not a valid alias name" && return 1
|
||||||
|
echo "Removing alias $name"
|
||||||
|
rm "$aliasPath" >> /dev/null 2>&1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
local name="$1"
|
local name="$1"
|
||||||
|
|
||||||
if [[ $# == 1 ]]; then
|
if [[ $# == 1 ]]; then
|
||||||
|
@ -917,10 +927,9 @@ dnvm()
|
||||||
[[ $# -ne 2 ]] && __dnvm_help && return
|
[[ $# -ne 2 ]] && __dnvm_help && return
|
||||||
|
|
||||||
local name=$2
|
local name=$2
|
||||||
local aliasPath="$_DNVM_ALIAS_DIR/$name.alias"
|
echo "This command has been deprecated. Use '$_DNVM_COMMAND_NAME alias -d' instead"
|
||||||
[[ ! -e "$aliasPath" ]] && echo "Cannot remove alias, '$name' is not a valid alias name" && return 1
|
$_DNVM_COMMAND_NAME alias -d $name
|
||||||
echo "Removing alias $name"
|
return $?
|
||||||
rm "$aliasPath" >> /dev/null 2>&1
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"list" )
|
"list" )
|
||||||
|
|
|
@ -5,7 +5,7 @@ source $_DNVM_PATH
|
||||||
$_DNVM_COMMAND_NAME alias test_alias_unalias "$_TEST_VERSION"
|
$_DNVM_COMMAND_NAME alias test_alias_unalias "$_TEST_VERSION"
|
||||||
|
|
||||||
# Unalias it
|
# Unalias it
|
||||||
$_DNVM_COMMAND_NAME unalias test_alias_unalias
|
$_DNVM_COMMAND_NAME alias -d test_alias_unalias
|
||||||
|
|
||||||
# Check the alias file
|
# Check the alias file
|
||||||
[ ! -e "$DNX_USER_HOME/alias/test_alias_unalias.alias" ] || die "test alias was not removed"
|
[ ! -e "$DNX_USER_HOME/alias/test_alias_unalias.alias" ] || die "test alias was not removed"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче