[systemd-devel] [PATCH] zsh-completion: journalctl query by binary and device

Lennart Poettering lennart at poettering.net
Tue Mar 5 12:06:28 PST 2013


On Tue, 05.03.13 14:32, Daniel Wallace (danielwallace at gtmanfred.com) wrote:

> implement 1883552c3d8 from bash completion in zsh-completion

Thanks, applied!

> ---
>  shell-completion/systemd-zsh-completion.zsh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
> index 46e29b2..77b26f6 100644
> --- a/shell-completion/systemd-zsh-completion.zsh
> +++ b/shell-completion/systemd-zsh-completion.zsh
> @@ -94,6 +94,7 @@ _ctls()
>                  '--verify[Verify journal file consistency]' \
>                  '--list-catalog[List messages in catalog]' \
>                  '--update-catalog[Update binary catalog database]' \
> +                '*::default: _journal_none'
>          ;;
>          localectl)
>              _arguments \
> @@ -608,6 +609,7 @@ _list_fields() {
>                      _{P,U,G}ID _COMM _EXE _CMDLINE
>                      _AUDIT_{SESSION,LOGINUID}
>                      _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
> +                    _SYSTEMD_USER_UNIT
>                      _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
>                      _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
>                      _KERNEL_{DEVICE,SUBSYSTEM}
> @@ -616,6 +618,15 @@ _list_fields() {
>      _describe 'possible fields' journal_fields
>  }
>  
> +_journal_none() {
> +    local -a _commands _files
> +    _commands=( ${(f)"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
> +    _alternative : \
> +        'files:/dev files:_files -W /dev -P /dev/' \
> +        "commands:commands:($_commands[@])" \
> +        'fields:fields:_list_fields'
> +}
> +
>  _journal_fields() {
>      local -a _fields cmd
>      cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list