Skip to content

Commit

Permalink
feat: converting to unset rather than remove
Browse files Browse the repository at this point in the history
Renaming to unset to indicate we will not throw an error if it did not exist.

* #18
  • Loading branch information
DeveloperC286 committed Jan 27, 2024
1 parent 4a4861e commit 31313fb
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/zsh-simple-abbreviations
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ case $1 in
fi
;;

--remove)
--unset)
if [[ $# -ne 2 ]]; then
echo "zsh_simple_abbreviations remove sub-command requires only a key."
echo "zsh_simple_abbreviations unset sub-command requires only a key."
return 1
fi

local key=${2}

if [[ "${key}" =~ ${KEY_REGEX} ]]; then
if [[ -n "${ZSH_SIMPLE_ABBREVIATIONS[$key]}" ]]; then
unset "_zsh_simple_abbreviations[$key]"
else
echo "zsh_simple_abbreviations remove sub-command key does not match any abbreviations."
return 1
fi
unset "ZSH_SIMPLE_ABBREVIATIONS[${key}]"
else
echo "zsh_simple_abbreviations key '${key}' contains non-alphanumeric characters."
return 1
Expand Down

0 comments on commit 31313fb

Please sign in to comment.