From a4f44972076ac86bde7f8b96c18b10807d580965 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Mon, 22 Apr 2019 22:04:24 -0500 Subject: 44242: Completion: Use _pick_variant -b to detect builtins --- Completion/Unix/Command/_rmdir | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'Completion/Unix/Command/_rmdir') diff --git a/Completion/Unix/Command/_rmdir b/Completion/Unix/Command/_rmdir index 0f5e16912..2ae0fd9b2 100644 --- a/Completion/Unix/Command/_rmdir +++ b/Completion/Unix/Command/_rmdir @@ -1,22 +1,30 @@ #compdef rmdir grmdir +local variant local -a args args=( '(-p --parents)'{-p,--parents}'[remove each component of the specified paths]' ) -if _pick_variant gnu=GNU unix --version; then - args+=( - '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]' - '(-v --verbose)'{-v,--verbose}'[be verbose]' - ) -else - args=(${args:#*\)--*}) - if [[ $OSTYPE == (dragonfly|freebsd)* ]]; then +_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version +case $variant; in + gnu) + args+=( + '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]' + '(-v --verbose)'{-v,--verbose}'[be verbose]' + ) + ;; + zsh) + args=() + ;; + *) + args=(${args:#*\)--*}) + ;| + dragonfly*|freebsd*) args+=('-v[be verbose]') - fi -fi + ;; +esac _arguments -s -S -A '-*' \ $args \ -- cgit 1.4.1