summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Zsh/Context/_subscript31
2 files changed, 34 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c216788f..09ce4f4bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-05-04 Oliver Kiddle <opk@zsh.org>
+
+ * 14227: Completion/Zsh/Context/_subscript, complete subscript flags
+
2001-05-04 Bart Schaefer <schaefer@zsh.org>
* 14224: Completion/Unix/Commmand/_cvs: Complete path prefixes for
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript
index 8e1449357..c5e80d0ea 100644
--- a/Completion/Zsh/Context/_subscript
+++ b/Completion/Zsh/Context/_subscript
@@ -1,6 +1,6 @@
#compdef -subscript-
-local expl ind osuf=']'
+local expl ind osuf=']' flags
if [[ "$1" = -q ]]; then
osuf='] '
@@ -8,10 +8,39 @@ if [[ "$1" = -q ]]; then
shift
fi
+compset -P '\([^\)]##\)' # remove subscript flags
+
if [[ "$PREFIX" = :* ]]; then
_wanted characters expl 'character class' \
compadd -p: -S ':]' alnum alpha blank cntrl digit graph \
lower print punct space upper xdigit
+elif compset -P '\('; then
+ compset -S '\)*'
+
+ case ${(Pt)${compstate[parameter]}} in
+ assoc*) flags=(
+ '(R k K i I)r[return first matching value]'
+ '(r k K i I)R[return value of first matching key]'
+ '(r R K i I)k[return all values with matching keys]'
+ '(r R k i I)K[return value of first matching key]'
+ '(r R k K I)i[return first matching key]'
+ '(r R k K i)I[return all matching keys]'
+ );;
+ (|scalar*)) flags=(
+ 'w[make subscripting work on words of scalar]'
+ 's[specify word separator]'
+ 'p[recognise escape sequences in subsequent s flag]'
+ );&
+ array*) flags=($flags
+ 'n[specify match to return]'
+ 'b[begin with specified element]'
+ '(r R k K i)I[reverse subscript giving index of last match]'
+ '(r k K i I)R[reverse subscripting giving last match]'
+ '(R k K i I)r[reverse subscripting giving first match]'
+ );;
+ esac
+
+ _values -s '' 'subscript flags' $flags
elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
local suf