_journalctl revision f11880744c27209a42f502c690db86b38d2db14b
286N/A#compdef journalctl
286N/A
286N/A_outputmodes() {
286N/A local -a _output_opts
286N/A _output_opts=(short short-monotonic verbose export json json-pretty json-see cat)
286N/A _describe -t output 'output mode' _output_opts || compadd "$@"
286N/A}
286N/A
286N/A_list_fields() {
286N/A local -a journal_fields
286N/A journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
286N/A ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
286N/A _{P,U,G}ID _COMM _EXE _CMDLINE
286N/A _AUDIT_{SESSION,LOGINUID}
286N/A _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
286N/A _SYSTEMD_USER_UNIT USER_UNIT
286N/A _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
286N/A _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
286N/A _KERNEL_{DEVICE,SUBSYSTEM}
286N/A _UDEV_{SYSNAME,DEVNODE,DEVLINK}
286N/A __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
286N/A case $_jrnl_none in
286N/A yes) _values -s '=' 'possible fields' \
286N/A "${journal_fields[@]}:value:_journal_fields ${words[CURRENT]%%=*}" ;;
286N/A *) _describe 'possible fields' journal_fields ;;
286N/A esac
286N/A}
286N/A
286N/A_journal_none() {
286N/A local -a _commands _files _jrnl_none
286N/A # Setting use-cache will slow this down considerably
286N/A _commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
286N/A _jrnl_none='yes'
286N/A _alternative : \
286N/A 'files:/dev files:_files -W /dev -P /dev/' \
286N/A "commands:commands:($_commands[@])" \
286N/A 'fields:fields:_list_fields'
286N/A}
286N/A
286N/A_journal_fields() {
286N/A local -a _fields cmd
286N/A cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )
286N/A _fields=( ${(f)"$(_call_program fields $cmd[@])"} )
286N/A typeset -U _fields
286N/A _describe 'possible values' _fields
286N/A}
286N/A
286N/A_journal_boots() {
286N/A local -a _bootid _previousboots
286N/A _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"} )
286N/A _previousboots=( -{1..${#_bootid}} )
286N/A _alternative : \
286N/A "offsets:boot offsets:(${_previousboots[1,-2]})" \
286N/A "bootid:boot ids:(${_bootid[@]})"
286N/A}
286N/A
286N/A_arguments -s \
286N/A {-h,--help}'[Show this help]' \
286N/A '--version[Show package version]' \
286N/A '--no-pager[Do not pipe output into a pager]' \
286N/A {-l,--full}'[Show long fields in full]' \
286N/A {-a,--all}'[Show all fields, including long and unprintable]' \
286N/A {-f,--follow}'[Follow journal]' \
286N/A {-e,--pager-end}'[Jump to the end of the journal in the pager]' \
286N/A {-n+,--lines=}'[Number of journal entries to show]:integer' \
286N/A '--no-tail[Show all lines, even in follow mode]' \
286N/A {-r,--reverse}'[Reverse output]' \
286N/A {-o+,--output=}'[Change journal output mode]:output modes:_outputmodes' \
286N/A {-x,--catalog}'[Show explanatory texts with each log line]' \
286N/A {-q,--quiet}"[Don't show privilege warning]" \
286N/A {-m,--merge}'[Show entries from all available journals]' \
286N/A {-b+,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \
286N/A '--list-boots[List boots ordered by time]' \
286N/A {-k,--dmesg}'[Show only kernel messages, Implies -b]' \
286N/A {-u+,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
286N/A '--user-unit=[Show data only from the specified user session unit]:units:_journal_fields USER_UNIT' \
286N/A {-p+,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
286N/A {-c+,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
286N/A '--after-cursor=[Start showing entries from the location in the journal after the cursor]:cursors:_journal_fields __CURSORS' \
286N/A '--since=[Start showing entries newer or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
286N/A '--until=[Stop showing entries older or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
286N/A {-F,--field=}'[List all values a certain field takes]:Fields:_list_fields' \
286N/A '--system[Show system and kernel messages]' \
286N/A '--user[Show messages from user services]' \
286N/A {-D+,--directory=}'[Show journal files from directory]:directories:_directories' \
286N/A '--file=[Operate on specified journal files]:file:_files' \
286N/A '--root=[Operate on catalog hierarchy under specified directory]:directories:_directories' \
286N/A '--new-id128[Generate a new 128 Bit ID]' \
286N/A '--header[Show journal header information]' \
286N/A '--disk-usage[Show total disk usage]' \
286N/A '--list-catalog[List messages in catalog]' \
286N/A '--dump-catalog[Dump messages in catalog]' \
286N/A '--update-catalog[Update binary catalog database]' \
286N/A '--setup-keys[Generate new FSS key pair]' \
286N/A '--force[Force recreation of FSS keys]' \
286N/A '--interval=[Time interval for changing the FSS sealing key]:time interval' \
286N/A '--verify[Verify journal file consistency]' \
286N/A '--verify-key=[Specify FSS verification key]:FSS key' \
286N/A '*::default: _journal_none'
286N/A