mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
dmesg completions for all the platforms
+ tweaks for Linux: shorter descriptions, suppress file completions + Add correct completions for macOS, NetBSD, FreeBSD, OpenBSD, DragonFly + Solaris dmesg has no options, so complete nothing there
This commit is contained in:
parent
62526a3ac8
commit
7ececa4c69
1 changed files with 50 additions and 19 deletions
|
@ -1,20 +1,51 @@
|
|||
set -l levels '( __fish_complete_list , "echo emerg\nalert\ncrit\nerr\nwarn\nnotice\ninfo\ndebug" )'
|
||||
complete -c dmesg -s C -l clear -d 'Clear the kernel ring buffer'
|
||||
complete -c dmesg -s c -l read-clear -d 'Read and clear all messages'
|
||||
complete -c dmesg -s D -l console-off -d 'Disable printing messages to console'
|
||||
complete -c dmesg -s d -l show-delta -d 'Show time delta between printed messages'
|
||||
complete -c dmesg -s E -l console-on -d 'Enable printing messages to console'
|
||||
complete -c dmesg -s F -l file -d 'Use the file instead of the kernel log buffer'
|
||||
complete -c dmesg -s f -l facility -d 'Restrict output to defined facilities' -xa '( __fish_complete_list , "echo kern\nuser\nmail\ndaemon\nauth\nsyslog\nlpr\nnews" )'
|
||||
complete -c dmesg -s h -l help -d 'Display this help and exit'
|
||||
complete -c dmesg -s k -l kernel -d 'Display kernel messages'
|
||||
complete -c dmesg -s l -l level -d 'Restrict output to defined levels' -xa $levels
|
||||
complete -c dmesg -s n -l console-level -d 'Set level of messages printed to console' -xa $levels
|
||||
complete -c dmesg -s r -l raw -d 'Print the raw message buffer'
|
||||
complete -c dmesg -s s -l buffer-size -d 'Buffer size to query the kernel ring buffer' -x
|
||||
complete -c dmesg -s T -l ctime -d 'Show human readable timestamp '
|
||||
complete -c dmesg -s t -l notime -d 'Don\'t print messages timestamp'
|
||||
complete -c dmesg -s u -l userspace -d 'Display userspace messages'
|
||||
complete -c dmesg -s V -l version -d 'Output version information and exit'
|
||||
complete -c dmesg -s x -l decode -d 'Decode facility and level to readable string'
|
||||
complete -c dmesg -f -d 'Display system message buffer'
|
||||
|
||||
switch (uname -s)
|
||||
#
|
||||
# Solaris
|
||||
#
|
||||
case SunOS
|
||||
exit 1 # no options, we are done
|
||||
#
|
||||
# Loonix dmesg
|
||||
#
|
||||
case Linux
|
||||
set -l levels '( __fish_complete_list , "echo emerg\nalert\ncrit\nerr\nwarn\nnotice\ninfo\ndebug" )'
|
||||
complete -c dmesg -s C -l clear -f -d'Clear kernel ring buffer'
|
||||
complete -c dmesg -s c -l read-clear -f -d'Read & clear all msgs'
|
||||
complete -c dmesg -s D -l console-off -f -d'Disable writing to console'
|
||||
complete -c dmesg -s d -l show-delta -f -d'Show timestamp deltas'
|
||||
complete -c dmesg -s E -l console-on -f -d'Enable writing to console'
|
||||
complete -c dmesg -s F -l file -r -d'Use file instead of log buffer'
|
||||
complete -c dmesg -s f -l facility -x -d'Only print for given facilities' -a '( __fish_complete_list , "echo kern\nuser\nmail\ndaemon\nauth\nsyslog\nlpr\nnews" )'
|
||||
complete -c dmesg -s h -l help -f -d'Display help'
|
||||
complete -c dmesg -s k -l kernel -f -d'Print kernel messages'
|
||||
complete -c dmesg -s l -l level -x -d'Restrict output to given levels' -a $levels
|
||||
complete -c dmesg -s n -l console-level -x -d'Adjust threshold to print to console' -a $levels
|
||||
complete -c dmesg -s r -l raw -f -d'Print raw message buffer'
|
||||
complete -c dmesg -s s -l buffer-size -x -d'Buffer size to query kernel'
|
||||
complete -c dmesg -s T -l ctime -f -d'Human-readable timestamps'
|
||||
complete -c dmesg -s t -l notime -f -d'Don\'t print timestamps'
|
||||
complete -c dmesg -s u -l userspace -f -d'Print userspace messages'
|
||||
complete -c dmesg -s V -l version -f -d'Show dmesg version'
|
||||
complete -c dmesg -s x -l decode -f -d'Decode facility & level numbers'
|
||||
exit 0 # done
|
||||
#
|
||||
# unique options specific BSDs have
|
||||
#
|
||||
case NetBSD
|
||||
complete -c dmesg -s d -f -d'show timestamp deltas'
|
||||
complete -c dmesg -s T -f -d'human-readable timestamps'
|
||||
complete -c dmesg -s t -f -d'don\'t print timestamps'
|
||||
case OpenBSD
|
||||
complete -c dmesg -s S -f -d'display console message buffer-size'
|
||||
case FreeBSD DragonFly
|
||||
complete -c dmesg -s a -f -d'print all data in the message buffer'
|
||||
complete -c dmesg -s c -f -d'clear kernel buffer after printing'
|
||||
end
|
||||
|
||||
#
|
||||
# common BSD dmesg options (macOS only does these two)
|
||||
#
|
||||
complete -c dmesg -s M -r -d'get namelist values from given core'
|
||||
complete -c dmesg -s N -r -d'get namelist from given kernel'
|
||||
|
|
Loading…
Reference in a new issue