Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _enable _disable: Workaround special characters in alias and function names breaking _arguments syntax
- X-seq: zsh-workers 31806
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: _enable _disable: Workaround special characters in alias and function names breaking _arguments syntax
- Date: Wed, 9 Oct 2013 19:03:22 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=JhvdVxQbk5rQQsYPbKu7U7jcaRSZHyG7p82wnl6D0MA=; b=XLZIlb6ndlXzthN6BYs+Tig77RFsNFk8My7V6frazaWVLXJL6E/Q35bIIzJjFC0/sc aKgXoY8isgFx8hvDjs9NLbSTQuwZwARQtukOx/Y3BEelqI1OS4Kb6WxF/MK6hHHOi9iL 6NU0TDECNvTiTi68bqkG2sfMbmPG6YaQCmu6cFvyuNLJUlKUVgrjLDpFyYl/LrkcLhCL fiwyTP5WDxbDzQGXp/7kTqwG8WkYZbXA0nQi5Kb2wrgeNh84NtUnh4ScrQEJePjyzpzh kkKFQpdsIE6m0VExo4qzJczUkIVAN7Kf+YSs7SUO30eI9xWJ9zs+byR9MWoiRPA+gb24 q9Nw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
While looking at these I realized that an alias ( would break the
completion, this fixes that.
---
Completion/Zsh/Command/_disable | 12 +++++++++---
Completion/Zsh/Command/_enable | 12 +++++++++---
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable
index 68be75f..52b82a6 100644
--- a/Completion/Zsh/Command/_disable
+++ b/Completion/Zsh/Command/_disable
@@ -1,10 +1,16 @@
#compdef disable
+local -a ali_arr sali_arr func_arr
+
+ali_arr=(${(k)aliases} ${(k)galiases})
+sali_arr=(${(k)saliases})
+func_arr=(${(k)functions})
+
_arguments -C -s -A "-*" -S \
- "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:(${(k)aliases} ${(k)galiases})" \
- "(-a -r -s -p)-f[act on functions]:*:functions:(${(k)functions})" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
"(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \
- "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:(${(k)saliases})" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
"(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)builtins})"
diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable
index f773782..9410651 100644
--- a/Completion/Zsh/Command/_enable
+++ b/Completion/Zsh/Command/_enable
@@ -1,10 +1,16 @@
#compdef enable
+local -a ali_arr sali_arr func_arr
+
+ali_arr=(${(k)dis_aliases} ${(k)dis_galiases})
+sali_arr=(${(k)dis_saliases})
+func_arr=(${(k)dis_functions})
+
_arguments -C -s -A "-*" -S \
- "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:(${(k)dis_aliases} ${(k)dis_galiases})" \
- "(-a -r -s -p)-f[act on functions]:*:functions:(${(k)dis_functions})" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
"(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
- "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:(${(k)dis_saliases})" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
"(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)dis_builtins})"
--
1.8.2-rc3
Messages sorted by:
Reverse Date,
Date,
Thread,
Author