Compare commits

..

2 Commits

Author SHA1 Message Date
Ronan Pigott 4b6d94a1e5 shell-completion/zsh: update systemd-analyze completions 2020-04-27 08:40:15 +02:00
Haochen Tong f5b3be308d zsh: fix disable/enable completion
The "preset" column introduced in
b01c1f305c breaks zsh completion for
systemctl disable/enable. Fix by ignoring everything after the last
space in a line.
2020-04-27 08:12:27 +02:00
2 changed files with 25 additions and 4 deletions

View File

@ -221,7 +221,11 @@ __systemctl()
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "$PREFIX*" )"}%% *} ) } _systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "$PREFIX*" )"}%% *} ) }
(( $+functions[_systemctl_unit_state] )) || (( $+functions[_systemctl_unit_state] )) ||
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" ) ) } _systemctl_unit_state() {
setopt localoptions extendedglob
typeset -gA _sys_unit_state
_sys_unit_state=( ${=${${(f)"$(__systemctl list-unit-files "$PREFIX*" )"}%%[[:space:]]#}% *} )
}
local fun local fun
# Completion functions for ALL_UNITS # Completion functions for ALL_UNITS

View File

@ -27,6 +27,16 @@
_describe -t state 'state' _states || compadd "$@" _describe -t state 'state' _states || compadd "$@"
} }
(( $+functions[_systemd-analyze_cat-config] )) ||
_systemd-analyze_cat-config() {
_files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
}
(( $+functions[_systemd-analyze_security] )) ||
_systemd-analyze_security() {
_sd_unit_files
}
(( $+functions[_systemd-analyze_commands] )) || (( $+functions[_systemd-analyze_commands] )) ||
_systemd-analyze_commands(){ _systemd-analyze_commands(){
local -a _systemd_analyze_cmds local -a _systemd_analyze_cmds
@ -38,13 +48,20 @@
'plot:Output SVG graphic showing service initialization' 'plot:Output SVG graphic showing service initialization'
'dot:Dump dependency graph (in dot(1) format)' 'dot:Dump dependency graph (in dot(1) format)'
'dump:Dump server status' 'dump:Dump server status'
'cat-config:Cat systemd config files'
'unit-files:List files and symlinks for units'
'unit-paths:List unit load paths' 'unit-paths:List unit load paths'
'log-level:Get/set systemd log threshold' 'exit-status:List known exit statuses'
'log-target:Get/set systemd log target'
'service-watchdogs:Get/set service watchdog status'
'syscall-filter:List syscalls in seccomp filter' 'syscall-filter:List syscalls in seccomp filter'
'condition:Evaluate Condition*= and Assert*= assignments'
'verify:Check unit files for correctness' 'verify:Check unit files for correctness'
'calendar:Validate repetitive calendar time events' 'calendar:Validate repetitive calendar time events'
'timestamp:Parse a systemd syntax timestamp'
'timespan:Parse a systemd syntax timespan'
'security:Analyze security settings of a service'
# 'log-level:Get/set systemd log threshold'
# 'log-target:Get/set systemd log target'
# 'service-watchdogs:Get/set service watchdog status'
) )
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then