summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2025-01-02 03:48:58 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2025-01-02 03:48:58 +0100
commit0578c26bd68fa729d0d198b6e9f864b3b317e419 (patch)
tree5f7e36cb3c7b9472be97ee5c9411238a3f11dadf
parent60-sensor.hwdb: Loosen model mask to include entire series (diff)
downloadsystemd-0578c26bd68fa729d0d198b6e9f864b3b317e419.tar.xz
systemd-0578c26bd68fa729d0d198b6e9f864b3b317e419.zip
bash-completion/journalctl: list user units when --user is already specified
Follow-up for 52051dd84c45c745ca877d8893be6f71aa27bf97. Fixes #35794.
-rw-r--r--shell-completion/bash/journalctl6
1 files changed, 5 insertions, 1 deletions
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl
index 5d1cc174c9..e70d799905 100644
--- a/shell-completion/bash/journalctl
+++ b/shell-completion/bash/journalctl
@@ -94,7 +94,11 @@ _journalctl() {
compopt -o nosort
;;
--unit|-u)
- comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
+ if __contains_word "--user" ${COMP_WORDS[*]}; then
+ comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null)
+ else
+ comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
+ fi
# Similarly to systemctl, we need to distinguish between
# escaped and unescaped names in order to be able to correctly
# complete them. In this particular case, if the name we're