diff options
| author | Karel Zak <kzak@redhat.com> | 2024-09-05 11:59:57 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2024-09-05 11:59:57 +0200 |
| commit | a3bf59a6f497a9314d4671ddd481235e2eecbbec (patch) | |
| tree | 914f91b268f4ab3fb45601076b7a83712dcfc6d4 /bash-completion | |
| parent | 7d13654dd363c8be44044d0e071e99f99599fbda (diff) | |
| parent | 3b7aeba581e4421f25b9a739c43eb5fe3bdb31be (diff) | |
| download | util-linux-a3bf59a6f497a9314d4671ddd481235e2eecbbec.tar.gz | |
Merge branch 'sg' of https://github.com/tmpgnh/util-linux
* 'sg' of https://github.com/tmpgnh/util-linux:
Optionally execute a program after group change
Diffstat (limited to 'bash-completion')
| -rw-r--r-- | bash-completion/newgrp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bash-completion/newgrp b/bash-completion/newgrp index 1e39c0f42e..c6d678b934 100644 --- a/bash-completion/newgrp +++ b/bash-completion/newgrp @@ -8,15 +8,23 @@ _newgrp_module() '-h'|'--help'|'-V'|'--version') return 0 ;; + '-c'|'--command') + COMPREPLY=( $(compgen -c -- $cur) ) + return 0 + ;; esac case $cur in -*) - OPTS="--version --help" + OPTS="--version --help --command" COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac - COMPREPLY=( $(compgen -g -- $cur) ) + if (( COMP_CWORD == 1 )) || [[ " ${COMP_WORDS[@]}" =~ " "-?-c ]]; then + COMPREPLY=( $(compgen -g -- $cur) ) + else + COMPREPLY=( $(compgen -c -- $cur) ) + fi return 0 } complete -F _newgrp_module newgrp |
