diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-08 16:27:33 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-08 16:27:33 +0100 |
commit | 209b49ddb20845247436e035326c389f1ade0c78 (patch) | |
tree | f29fec702ccfd90d627e993eb378d454fcd12f30 | |
parent | ab80ea105a0115e70f28c3e362d9f1f213059a5a (diff) | |
parent | 2720e0c0f006f9951550648b68f74d6772426f39 (diff) |
Merge pull request #2549 from rhatdan/journalctl
Journalctl command completion should show machines
-rw-r--r-- | shell-completion/bash/journalctl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 321d439f0c..7c8a9ce361 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -24,6 +24,12 @@ __contains_word () { done } +__get_machines() { + local a b + (machinectl list-images --no-legend --no-pager; machinectl list --no-legend --no-pager; echo ".host") | \ + { while read a b; do echo " $a"; done; } | sort -u; +} + __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE _{P,U,G}ID _COMM _EXE _CMDLINE @@ -49,11 +55,11 @@ _journalctl() { --utc -x --catalog --no-full --force --dump-catalog --flush --rotate --sync' [ARG]='-b --boot --this-boot -D --directory --file -F --field - -o --output -u --unit --user-unit -p --priority + -M --machine -o --output -u --unit --user-unit -p --priority --vacuum-size --vacuum-time' [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until --after-cursor --verify-key -t --identifier - --root -M --machine' + --root' ) if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then @@ -74,6 +80,9 @@ _journalctl() { ;; --field|-F) comps=${__journal_fields[*]} + ;; + --machine|-M) + comps=$( __get_machines ) ;; --priority|-p) comps=${__syslog_priorities[*]} |