bash-completion/journalctl: list user units when --user is already specified (#35799)
Also, escape the current input before matching listed user units. Fixes #35794.
This commit is contained in:
@@ -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
|
||||
@@ -109,6 +113,10 @@ _journalctl() {
|
||||
;;
|
||||
--user-unit)
|
||||
comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null)
|
||||
if ! [[ $cur =~ '\\' ]]; then
|
||||
cur="$(printf '%q' $cur)"
|
||||
fi
|
||||
compopt -o filenames
|
||||
;;
|
||||
--identifier|-t|--exclude-identifier|-T)
|
||||
comps=$(journalctl -F 'SYSLOG_IDENTIFIER' 2>/dev/null)
|
||||
|
||||
Reference in New Issue
Block a user