chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test-barrier: add checks after the barrier constructor
[elogind.git]
/
shell-completion
/
bash
/
hostnamectl
diff --git
a/shell-completion/bash/hostnamectl
b/shell-completion/bash/hostnamectl
index a57bffe15f7647525d2ac6ba04b2bd9c39d5898e..a5e34600c806a07b42fe573e2e6bd7e4343998f0 100644
(file)
--- a/
shell-completion/bash/hostnamectl
+++ b/
shell-completion/bash/hostnamectl
@@
-18,9
+18,10
@@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
_hostnamectl() {
}
_hostnamectl() {
@@
-37,10
+38,11
@@
_hostnamectl() {
local -A VERBS=(
[STANDALONE]='status'
[ICONS]='set-icon-name'
local -A VERBS=(
[STANDALONE]='status'
[ICONS]='set-icon-name'
- [NAME]='set-hostname'
+ [NAME]='set-hostname set-deployment'
+ [CHASSIS]='set-chassis'
)
)
- for ((i=0; i <
=
COMP_CWORD; i++)); do
+ for ((i=0; i < COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
verb=${COMP_WORDS[i]}
break
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
verb=${COMP_WORDS[i]}
break
@@
-49,6
+51,8
@@
_hostnamectl() {
if [[ -z $verb ]]; then
comps=${VERBS[*]}
if [[ -z $verb ]]; then
comps=${VERBS[*]}
+ elif __contains_word "$verb" ${VERBS[CHASSIS]}; then
+ comps='desktop laptop server tablet handset watch vm container'
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then
comps=''
fi
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then
comps=''
fi