diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-26 12:13:36 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-26 12:13:36 +0000 |
commit | aa99b19c088324b17c0c5e1caee4fc3b5777deab (patch) | |
tree | 6489214ac325f9b473c254fb8f8c545b3255855d /Completion/Base/Utility/_guard | |
parent | 105009726b3276a16ad39930aba046032597a039 (diff) | |
download | zsh-aa99b19c088324b17c0c5e1caee4fc3b5777deab.tar.gz zsh-aa99b19c088324b17c0c5e1caee4fc3b5777deab.tar.xz zsh-aa99b19c088324b17c0c5e1caee4fc3b5777deab.zip |
rename -W option to -w, add new -W option which makes _arguments complete options even after options that get their argument in the same word; new _guard function for conditionally displaying messages (14105)
Diffstat (limited to 'Completion/Base/Utility/_guard')
-rw-r--r-- | Completion/Base/Utility/_guard | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Base/Utility/_guard b/Completion/Base/Utility/_guard new file mode 100644 index 000000000..4c07fe1b9 --- /dev/null +++ b/Completion/Base/Utility/_guard @@ -0,0 +1,17 @@ +#autoload + +local mesg pat garbage + +mesg=() +zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:=mesg + +[[ "$PREFIX$SUFFIX" != $~1 ]] && return 1 + +if [[ $# -gt 1 || $#mesg -eq 0 ]]; then + shift + _message "$*" +else + _message -r "$mesg[2]" +fi + +[[ -n "$PREFIX$SUFFIX" ]] |