zsh-workers
 help / color / mirror / code / Atom feed
5b063e44d9b317b408c9f7abde1e41919b7e5a64 blob 3533 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
#compdef lsmod modinfo modprobe rmmod insmod

local curcontext="$curcontext" expl state line modules ign args ret=1

args=(
  '(-)'{-V,--version}'[print version]'
  '(-)'{-h,--help}'[print help text]'
)

case "$service" in
  lsmod) _arguments -s "$args[@]" && return ;;
  
  modinfo)
    _arguments -s -C "$args[@]" \
      '(-)'{-a,--author}"[display the module's author]" \
      '(-)'{-d,--description}"[display the module's description]" \
      '(-)'{-f+,--format}'[display module info in specified format]' \
      '(-)'{-l,--license}"[display the module's license]" \
      '(-)'{-n,--filename}"[display the module's filename]" \
      '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
      '(-)'{-F,--field}"[display only selected module's information]:module_field:(
        alias author depends description filename license parm)" \
      '1:module file:->all_modules' && ret=0
  ;;

  modprobe)
    ign='-h --help -V --version -c --showconfig'
    _arguments -s -C "$args[@]" \
      "(-a --all $ign)"{-a,--all}'[load all matching modules]' \
      '(-)'{-c,--showconfig}'[show current configuration]' \
      "(-d --debug $ign)"{-d,--debug}'[print debug info]' \
      "(-k --autoclean $ign)"{-k,--autoclean}'[set autoclean]' \
      "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \
      "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \
      "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \
      "(* -t --type $ign)"{-t,--type}'[module type]:module type' \
      "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \
      '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \
      "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
      "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
      "(-c $ign)1:modules:->all_modules" \
      "(-c -l --list -t --type $ign)*:params:->params" && ret=0
      
      [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules        
  ;;

  rmmod)
    _arguments -s -C "$args[@]" \
      '(-a --all)'{-a,--all}'[remove all unused autocleanable modules]' \
      '(-e --persist)'{-e,--persist}'[save persistent data]' \
      '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \
      '(-s --syslog)'{-s,--syslog}'[output to syslog]' \
      '(-v --verbose)'{-v,--verbose}'[be verbose]' \
      '*:loaded module:->loaded_modules' && ret=0
  ;;

  insmod)
    _arguments \
      '1:module file:_files' \
      '*:module parameters:' && ret=0
  ;;
esac 

case "$state" in
  loaded_modules)
    if [[ -r /proc/modules ]]; then
     modules=(${${(f)"$(</proc/modules)"}%% *})
    elif [[ -x /sbin/lsmod ]]; then
     modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *})
    else
     return 1
    fi
    
    _wanted modules expl 'loaded module' compadd -a modules && return
  ;;

  all_modules)
    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%%.*} )
    _tags files modules
    while _tags; do
      _requested files expl "module file"  _files && ret=0
      _requested modules expl module compadd -a modules && ret=0
    done
  ;;

  params)
    if compset -P '*='; then
      _message -e value 'parameter value'
    else
      typeset -A val_args

      _values 'module parameter' \
        ${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\] && ret=0
    fi
  ;;
esac

return ret
debug log:

solving 5b063e4 ...
found 5b063e4 in https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
found e2efb53 in https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
found 7cc539f in https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
found 7322903 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 7322903633cfceafab77209deeb5c03b45c54319	Completion/Linux/Command/_modutils

applying [1/3] https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 7322903..7cc539f 100644


applying [2/3] https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 7cc539f..e2efb53 100644


applying [3/3] https://inbox.vuxu.org/zsh-workers/slrngdfjfe.1rn.joerg@alea.gnuu.de/
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index e2efb53..5b063e4 100644

Checking patch Completion/Linux/Command/_modutils...
Applied patch Completion/Linux/Command/_modutils cleanly.
Checking patch Completion/Linux/Command/_modutils...
Applied patch Completion/Linux/Command/_modutils cleanly.
Checking patch Completion/Linux/Command/_modutils...
Applied patch Completion/Linux/Command/_modutils cleanly.

index at:
100644 5b063e44d9b317b408c9f7abde1e41919b7e5a64	Completion/Linux/Command/_modutils

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).