summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-11-12 10:34:32 +0100
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-11-12 10:34:32 +0100
commit082f703ccdfd77fa5301023b3031c873143cdbf3 (patch)
tree1c7f7a2794ee1f8eb27a524bb37760a1e4e9b421
parentd5fec6b512c1d588a5a3dee27226b870a3fe3363 (diff)
downloadzsh-082f703ccdfd77fa5301023b3031c873143cdbf3.tar.gz
zsh-082f703ccdfd77fa5301023b3031c873143cdbf3.tar.xz
zsh-082f703ccdfd77fa5301023b3031c873143cdbf3.zip
43818: complete math functions for other modules besides zsh/mathfunc
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Zsh/Type/_module_math_func13
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 138216e7d..e5bfb1f1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-11-12  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
+	* 43818: Completion/Zsh/Type/_module_math_func: complete math
+	functions for other modules besides zsh/mathfunc
+
 	* 43816: Completion/Linux/Command/_valgrind,
 	Completion/BSD/Command/_vmctl, Completion/Linux/Command/_ethtool,
 	Completion/Linux/Command/_losetup, Completion/Linux/Command/_lsblk,
diff --git a/Completion/Zsh/Type/_module_math_func b/Completion/Zsh/Type/_module_math_func
index 6be9c006a..5044bdf4c 100644
--- a/Completion/Zsh/Type/_module_math_func
+++ b/Completion/Zsh/Type/_module_math_func
@@ -1,9 +1,12 @@
 #autoload
 
-local expl
-local -a funcs
+local mod
+local -a funcs alts
+local -a modules=( example mathfunc system )
 
-funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+for mod in $modules; do
+  funcs=( ${${${(f)"$(zmodload -Fl zsh/$mod 2>/dev/null)"}:#^+f:*}##+f:} )
+  alts+=( "module-math-functions.${mod}:math function from zsh/${mod}:compadd -S '(' $funcs" )
+done
 
-_wanted module-math-functions expl 'math function from zsh/mathfunc' \
-    compadd -S '(' -q "$@" -a funcs
+_alternative $alts