]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash-completion/journalctl: list user units when --user is already specified
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 2 Jan 2025 02:48:58 +0000 (11:48 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 2 Jan 2025 02:48:58 +0000 (11:48 +0900)
Follow-up for 52051dd84c45c745ca877d8893be6f71aa27bf97.
Fixes #35794.

shell-completion/bash/journalctl

index 5d1cc174c928d6e66ecfc0e2db08ae4ff69124df..e70d7999055b5b0777465ff4e4a849dcf6028f3f 100644 (file)
@@ -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