diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 22d9eb2cfc..c7f6a05a6e 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -49,7 +49,8 @@ _journalctl() { --list-namespaces' [ARG]='-b --boot -D --directory --file -F --field -t --identifier -T --exclude-identifier --facility -M --machine -o --output - -u --unit --user-unit -p --priority --root --case-sensitive' + -u --unit --user-unit -p --priority --root --case-sensitive + --namespace' [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until --after-cursor --cursor-file --verify-key -g --grep --vacuum-size --vacuum-time --vacuum-files --output-fields' @@ -114,6 +115,9 @@ _journalctl() { --case-sensitive) comps='yes no' ;; + --namespace) + comps=$(journalctl --list-namespaces --output=cat 2>/dev/null) + ;; *) return 0 ;; diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl index 7e18d43158..9c132b8731 100644 --- a/shell-completion/zsh/_journalctl +++ b/shell-completion/zsh/_journalctl @@ -63,6 +63,13 @@ _journalctl_facilities() { _describe 'possible values' _journalctl_facilities } +(( $+functions[_journalctl_namespaces] )) || +_journalctl_namespaces() { + local -a _journalctl_namespaces + _journalctl_namespaces=( ${(f)"$(_call_program namespaces "$service --list-namespaces --output=cat" 2>/dev/null)"} ) + _describe 'possible values' _journalctl_namespaces +} + # Build arguments for "journalctl" to be used in completion. # Use both --user and --system modes, they are not exclusive. local -a _modes; _modes=(--user --system) @@ -132,6 +139,7 @@ _arguments -s \ '--interval=[Time interval for changing the FSS sealing key]:time interval' \ '--list-catalog[List messages in catalog]' \ '--list-namespaces[List available journal namespaces]' \ + '--namespace[Show journal data from specified namespace]:namespace:_journalctl_namespaces' \ '--new-id128[Generate a new 128 Bit ID]' \ '--rotate[Request immediate rotation of the journal files]' \ '--setup-keys[Generate a new FSS key pair]' \