From 31313fbe5fb0a43ce8a3243c676c0917d250e630 Mon Sep 17 00:00:00 2001 From: DeveloperC Date: Fri, 26 Jan 2024 23:56:00 +0000 Subject: [PATCH] feat: converting to unset rather than remove Renaming to unset to indicate we will not throw an error if it did not exist. * https://github.com/DeveloperC286/zsh-simple-abbreviations/issues/18 --- src/zsh-simple-abbreviations | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/zsh-simple-abbreviations b/src/zsh-simple-abbreviations index 7fbe732..5889e79 100644 --- a/src/zsh-simple-abbreviations +++ b/src/zsh-simple-abbreviations @@ -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