summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_module
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_module')
-rw-r--r--Completion/Unix/Command/_module196
1 files changed, 173 insertions, 23 deletions
diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module
index b44dbdb60..1df12a3d9 100644
--- a/Completion/Unix/Command/_module
+++ b/Completion/Unix/Command/_module
@@ -1,29 +1,179 @@
#compdef module
-local context state line
-typeset -A opt_args
+# Main dispatcher
+_module()
+{
+ _arguments -s \
+ '(-H --help)'{--help,-H}'[display usage info]' \
+ '(-V --version)'{--version,-V}'[module command version and configuration options]' \
+ '(-f --force)'{--force,-f}'[force active dependency resolution]' \
+ '(-t --terse)'{--terse,-t}'[display avail and list output in short format]' \
+ '(-l --long)'{--long,-l}'[display avail and list output in long format]' \
+ '(-h --human)'{--human,-h}'[display short output in human-readable format]' \
+ '(-v --verbose)'{--verbose,-v}'[verbose]' \
+ '(-s --silent)'{--silent,-s}'[disable verbose messages]' \
+ '(-c --create)'{--create,-c}'[create caches]' \
+ '(-i --icase)'{--icase,-i}'[case insensitive]' \
+ '(-u --userlvl)'{--userlvl,-u}'[set user level to value]:level:(novice expert advanced)' \
+ '*::module command:_module_command'
+}
-_arguments \
- '(-f --force)'{--force,-f}'[force active dependency resolution]' \
- '(-t --terse)'{--terse,-t}'[display avail and list output in short format]' \
- '(-l --long)'{--long,-l}'[display avail and list output in long format]' \
- '(-h --human)'{--human,-h}'[display short output in human-readable format]' \
- '(-v --verbose)'{--verbose,-v}'[verbose]' \
- '(-s --silent)'{--silent,-s}'[disable verbose messages]' \
- '(-c --create)'{--create,-c}'[create caches]' \
- '(-i --icase)'{--icase,-i}'[case insensitive]' \
- '(-i --icase)'{--icase,-i}'[case insensitive]' \
- '(-u --userlvl)'{--userlvl,-u}'[set user level to value]:level:(novice expert advanced)' \
- '*::command:->subcmds' && return 0
+(( $+functions[_module_command] )) || _module_command()
+{
+ local -a _module_cmds
-case "$state" in
- (subcmds)
- if (( CURRENT == 1 )); then
- compadd -- help load add unload rm switch swap display show list \
- avail use unuse update clear purge whatis apropos keyword \
- initadd initprepend initswitch initlist initclear
+ _module_cmds=(
+ "help:Print the usage of each sub-command"
+ "load:Load a module into the shell environment"
+ "add:Load a module into the shell environment"
+ "unload:Remove a module from the shell environment"
+ "rm:Remove a module from the shell environment"
+ "switch:Switch loaded a loaded module with another module"
+ "swap:Switch loaded a loaded module with another module"
+ "display:Display information about a module"
+ "show:Display information about a module"
+ "list:List loaded modules"
+ "avail:List all available modules"
+ "use:Add a directory to MODULEPATH"
+ "unuse:Remove a directory from MODULEPATH"
+ "update:Reload all loaded modules"
+ "clear:Clear loaded modules information"
+ "purge:Unload all loaded modules"
+ "refresh:Refresh all non-persistent components of loaded modules"
+ "whatis:Display module information"
+ "appropos:Search for a given keyword in modules"
+ "keyword:Search for a given keyword in modules"
+ "initadd:Add or append a module to the user's shell init file"
+ "initprepend:Add or prepend a module to the user's shell init files"
+ "initrm:Remove a module from the user's shell init file"
+ "initswitch:Switch modules in the user's shell init file"
+ "initlist:List all loaded modules in the user's shell init files"
+ "initclear:Clear all modules from the user's shell init files"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'module command' _module_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+