bash-completion/write
raw| 1 | _write_module() |
| 2 | { |
| 3 | local cur prev |
| 4 | COMPREPLY=() |
| 5 | cur="${COMP_WORDS[COMP_CWORD]}" |
| 6 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 7 | case $prev in |
| 8 | '-h'|'--help'|'-V'|'--version') |
| 9 | return 0 |
| 10 | ;; |
| 11 | esac |
| 12 | case $COMP_CWORD in |
| 13 | 1) |
| 14 | COMPREPLY=( $(compgen -W '$(command users)' -- $cur) ) |
| 15 | return 0 |
| 16 | ;; |
| 17 | 2) |
| 18 | COMPREPLY=( $(compgen -W "$(command w -h $prev | command awk '{print $2}')" -- $cur) ) |
| 19 | return 0 |
| 20 | ;; |
| 21 | esac |
| 22 | return 0 |
| 23 | } |
| 24 | complete -F _write_module write |