aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-27 23:26:46 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-27 23:26:46 +0200
commit62e8493c179830662593f6db0793aa3d32b703d8 (patch)
treeee48a4d53c9cbe4fedf504c09ab53f52336d3d3b
parentbc9f6ae120ae210c2222297666b9f7ab0c4c2f8b (diff)
parent0d958efabe774800df9944e1dbf2a61a6f92ab26 (diff)
downloadponysay-62e8493c179830662593f6db0793aa3d32b703d8.tar.gz
ponysay-62e8493c179830662593f6db0793aa3d32b703d8.tar.bz2
ponysay-62e8493c179830662593f6db0793aa3d32b703d8.zip
Merge branch 'master' of github.com:erkin/ponysay
-rw-r--r--completion/zsh-completion.zsh48
1 files changed, 31 insertions, 17 deletions
diff --git a/completion/zsh-completion.zsh b/completion/zsh-completion.zsh
index 9d417ec..68487bd 100644
--- a/completion/zsh-completion.zsh
+++ b/completion/zsh-completion.zsh
@@ -1,18 +1,32 @@
-#compdef ponysay
-_shortopts=(
- '-v[Show version and exit]'
- '-h[Show this help and exit]'
- '-l[list pony names]'
- '-L[list pony names with alternatives]'
- '+l[list extra pony names]'
- '+L[list extra pony names with alternatives]'
- '-B[list balloon style names]'
- '-f[Select a pony (either a file name or a pony name)]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"'
- '-F[Select a extra pony]: :_path_files -W '/usr/share/ponysay/extraponies' -g "*(\:r)"'
- '-q[Select ponies for MLP:FiM quotes]'
- '-b[Selecy a balloon style]'
- '-W[The screen column where the message should be wrapped]'
+#compdef ponysay ponythink
+_opts=(
+ '(--version -v)'{-v,--version}'[Show version and exit]'
+ '(-h --help)'{-h,--help}'[Show this help and exit]'
+ '(-l --list)'{-l,--list}'[list pony names]'
+ '(-L --altlist)'{-L,--altlist}'[list pony names with alternatives]'
+ '(+l ++list)'{+l,++list}'[list extra pony names]'
+ '(+L ++altlist)'{+L,++altlist}'[list extra pony names with alternatives]'
+ '(-B --balloonlist)'{-B,--balloonlist}'[list balloon style names]'
+ '(-b --ballon)'{-b,--balloon}'[Selecy a balloon style]: :_path_files -W '/usr/share/ponysay/balloons' -g "*(\:r)"'
+ '(-c --compact)'{-c,--compat}'[Compress messages.]'
+ '(-W --wrap)'{-W,--wrap}'[The screen column where the message should be wrapped]'
)
-_arguments -s : \
- "$_shortopts[@]"
-
+_tty_select=(
+ '(-q --quite)'{-q,--quote}'[Select ponies for MLP:FiM quotes]: :_path_files -W '/usr/share/ponysay/ttyponies' -g "*(\:r)"'
+ '(-f --pony)'{-f,--pony}'[select pony]: :_path_files -W '/usr/share/ponysay/ttyponies/' -g "*(\:r)"'
+ '(-F ++pony)'{-F,++pony}'[Select a extra pony]: :_path_files -W '/usr/share/ponysay/extrattyponies' -g "*(\:r)"'
+ )
+_select=(
+ '(-q --quite)'{-q,--quote}'[Select ponies for MLP:FiM quotes]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"'
+ '(-f --pony)'{-f,--pony}'[select pony]: :_path_files -W '/usr/share/ponysay/ponies/' -g "*(\:r)"'
+ '(-F ++pony)'{-F,++pony}'[Select a extra pony]: :_path_files -W '/usr/share/ponysay/extraponies' -g "*(\:r)"'
+ )
+if [[ "${(f)"$(tty)"##*/}" == "tty*" ]]; then
+ _arguments \
+ "$_opts[@]" \
+ "$_tty_select[@]"
+else
+ _arguments \
+ "$_opts[@]" \
+ "$_select[@]"
+fi