diff --git a/tools/miaou-destroy b/tools/miaou-destroy index 5b1fe7e..94badda 100755 --- a/tools/miaou-destroy +++ b/tools/miaou-destroy @@ -13,6 +13,21 @@ function usage { echo "$(basename "$0") ... [--yes|-y] [--force|-f]" } +function flatten_short_options { + local -n result=$1 + shift + result=() + for word in "$@"; do + [[ $word == -- ]] && break + if [[ $word =~ ^-[a-z][a-z] ]]; then + word=${word:1} + for ((i = 0; i < ${#word}; i++)); do result+=("-${word:i:1}"); done + else + result+=("$word") + fi + done +} + function parse_options { while [[ $# -gt 0 ]]; do case "$1" in @@ -62,5 +77,6 @@ function destroy { # MAIN set -Eue -parse_options $* +flatten_short_options flat "$@" +parse_options "${flat[@]}" destroy