aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-12-17 14:44:38 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-17 14:44:58 +0900
commit1f7951241f0f85a05730eefd51d4a11e6e3c5ac7 (patch)
tree8d465b306f4a36d4370596914df61e13509ec7d3 /shell-completion
parentbash-completion: udevadm: suggest argument for several options (diff)
downloadsystemd-1f7951241f0f85a05730eefd51d4a11e6e3c5ac7.tar.gz
systemd-1f7951241f0f85a05730eefd51d4a11e6e3c5ac7.tar.bz2
systemd-1f7951241f0f85a05730eefd51d4a11e6e3c5ac7.zip
bash-completion: also suggests device units
Follow-up for b6854081ffb26c32a8d1440346f9ee5b9d2f1e57.
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/bash/udevadm9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm
index 1789454d8..7b33839b1 100644
--- a/shell-completion/bash/udevadm
+++ b/shell-completion/bash/udevadm
@@ -37,6 +37,11 @@ __get_all_devs() {
done
}
+__get_all_device_units() {
+ systemctl list-units -t device --full --no-legend --no-pager 2>/dev/null | \
+ { while read -r a b; do echo "$a"; done; }
+}
+
_udevadm() {
local i verb comps builtin
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -101,8 +106,8 @@ _udevadm() {
if [[ $cur = -* ]]; then
comps="${OPTS[COMMON]} ${OPTS[INFO_STANDALONE]} ${OPTS[INFO_ARG]}"
else
+ comps=$( __get_all_sysdevs; __get_all_device_units )
local IFS=$'\n'
- comps=$( __get_all_sysdevs )
fi
;;
'trigger')
@@ -132,8 +137,8 @@ _udevadm() {
if [[ $cur = -* ]]; then
comps="${OPTS[COMMON]} ${OPTS[TRIGGER_STANDALONE]} ${OPTS[TRIGGER_ARG]}"
else
+ comps=$( __get_all_sysdevs; __get_all_device_units )
local IFS=$'\n'
- comps=$( __get_all_sysdevs )
fi
;;
'settle')