mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
shell-completion: Add completion for systemd-analyze critical-chain
systemd-analyze critical-chain accepts an optional unit argument, however currently there's no shell-completion for it This change provides unit name completion for both bash and zsh. Closes: #20927
This commit is contained in:
parent
265f76be72
commit
b4bb96f3f2
@ -30,6 +30,11 @@ __get_machines() {
|
|||||||
machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; };
|
machinectl list --full --no-legend --no-pager | { while read a b; do echo " $a"; done; };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__get_units_all() {
|
||||||
|
systemctl list-units --no-legend --no-pager --plain --all | \
|
||||||
|
{ while read -r a b c; do echo " $a"; done }
|
||||||
|
}
|
||||||
|
|
||||||
__get_services() {
|
__get_services() {
|
||||||
systemctl list-units --no-legend --no-pager --plain -t service --all $1 | \
|
systemctl list-units --no-legend --no-pager --plain -t service --all $1 | \
|
||||||
{ while read -r a b c; do [[ $b == "loaded" ]]; echo " $a"; done }
|
{ while read -r a b c; do [[ $b == "loaded" ]]; echo " $a"; done }
|
||||||
@ -111,6 +116,8 @@ _systemd_analyze() {
|
|||||||
elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then
|
elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then
|
||||||
if [[ $cur = -* ]]; then
|
if [[ $cur = -* ]]; then
|
||||||
comps='--help --version --system --user --fuzz --no-pager'
|
comps='--help --version --system --user --fuzz --no-pager'
|
||||||
|
else
|
||||||
|
comps=$( __get_units_all )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[DOT]}; then
|
elif __contains_word "$verb" ${VERBS[DOT]}; then
|
||||||
|
@ -11,6 +11,16 @@
|
|||||||
_files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
|
_files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(( $+functions[_systemd-analyze_critical-chain] )) ||
|
||||||
|
_systemd-analyze_critical-chain() {
|
||||||
|
local -a _units
|
||||||
|
systemctl list-units --no-legend --no-pager --plain --all |
|
||||||
|
while read -r a b c; do
|
||||||
|
_units+=($a)
|
||||||
|
done
|
||||||
|
compadd -a _units
|
||||||
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_security] )) ||
|
(( $+functions[_systemd-analyze_security] )) ||
|
||||||
_systemd-analyze_security() {
|
_systemd-analyze_security() {
|
||||||
_sd_unit_files
|
_sd_unit_files
|
||||||
|
Loading…
Reference in New Issue
Block a user