1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-06 17:18:12 +03:00

bash-completion/journalctl: list user units when --user is already specified

Follow-up for 52051dd84c.
Fixes #35794.
This commit is contained in:
Yu Watanabe 2025-01-02 11:48:58 +09:00
parent 89c4fe6c21
commit 0578c26bd6

View 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