summaryrefslogtreecommitdiff
path: root/shell-completion
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-05-28 12:48:46 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-07-17 06:59:12 +0900
commit0a0564a1b581f19bee920c427376e63d4b36a54d (patch)
tree4d5fddaf017456b6312a9930084c4aca8e978227 /shell-completion
parent159a855b34c35484c28cf4b0178f93bc16447fac (diff)
downloadsystemd-0a0564a1b581f19bee920c427376e63d4b36a54d.tar.gz
bash-completion: support ntp-servers and revert command for timedatectl
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/timedatectl9
1 files changed, 9 insertions, 0 deletions
diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl
index 75796ff382..385dee7dd4 100644
--- a/shell-completion/bash/timedatectl
+++ b/shell-completion/bash/timedatectl
@@ -30,6 +30,12 @@ __get_machines() {
machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; };
}
+__get_interfaces(){
+ local name
+ for name in $(cd /sys/class/net && ls); do
+ [[ "$name" != "lo" ]] && echo "$name"
+ done
+}
_timedatectl() {
local i verb comps
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -60,6 +66,7 @@ _timedatectl() {
[STANDALONE]='status show list-timezones timesync-status show-timesync'
[TIMEZONES]='set-timezone'
[TIME]='set-time'
+ [IFNAME]='ntp-servers revert'
)
for ((i=0; i < COMP_CWORD; i++)); do
@@ -77,6 +84,8 @@ _timedatectl() {
comps=$(command timedatectl list-timezones)
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[TIME]}; then
comps=''
+ elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then
+ comps=$( __get_interfaces )
fi
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )