1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

shell-completion: add --global and unit-paths

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-02-08 12:09:28 +01:00
parent 31a5924ed8
commit ecd3717a74
2 changed files with 7 additions and 5 deletions

View File

@ -36,13 +36,13 @@ _systemd_analyze() {
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=( local -A OPTS=(
[STANDALONE]='-h --help --version --system --user --order --require --no-pager [STANDALONE]='-h --help --version --system --user --global --order --require --no-pager
--man=no --generators=yes' --man=no --generators=yes'
[ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern' [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern'
) )
local -A VERBS=( local -A VERBS=(
[STANDALONE]='time blame plot dump calendar' [STANDALONE]='time blame plot dump unit-paths calendar'
[CRITICAL_CHAIN]='critical-chain' [CRITICAL_CHAIN]='critical-chain'
[DOT]='dot' [DOT]='dot'
[LOG_LEVEL]='log-level' [LOG_LEVEL]='log-level'
@ -85,7 +85,7 @@ _systemd_analyze() {
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
if [[ $cur = -* ]]; then if [[ $cur = -* ]]; then
comps='--help --version --system --user' comps='--help --version --system --user --global'
fi fi
elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then elif __contains_word "$verb" ${VERBS[CRITICAL_CHAIN]}; then
@ -95,7 +95,7 @@ _systemd_analyze() {
elif __contains_word "$verb" ${VERBS[DOT]}; then elif __contains_word "$verb" ${VERBS[DOT]}; then
if [[ $cur = -* ]]; then if [[ $cur = -* ]]; then
comps='--help --version --system --user --from-pattern --to-pattern --order --require' comps='--help --version --system --user --global --from-pattern --to-pattern --order --require'
fi fi
elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then
@ -119,7 +119,7 @@ _systemd_analyze() {
elif __contains_word "$verb" ${VERBS[VERIFY]}; then elif __contains_word "$verb" ${VERBS[VERIFY]}; then
if [[ $cur = -* ]]; then if [[ $cur = -* ]]; then
comps='--help --version --system --user --man=no --generators=yes' comps='--help --version --system --user --global --man=no --generators=yes'
else else
comps=$( compgen -A file -- "$cur" ) comps=$( compgen -A file -- "$cur" )
compopt -o filenames compopt -o filenames

View File

@ -33,6 +33,7 @@ _systemd_analyze_command(){
'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'
'unit-paths':List unit load paths'
'log-level:Get/set systemd log threshold' 'log-level:Get/set systemd log threshold'
'log-target:Get/set systemd log target' 'log-target:Get/set systemd log target'
'service-watchdogs:Get/set service watchdog status' 'service-watchdogs:Get/set service watchdog status'
@ -62,6 +63,7 @@ _arguments \
'--version[Show package version]' \ '--version[Show package version]' \
'--system[Operate on system systemd instance]' \ '--system[Operate on system systemd instance]' \
'--user[Operate on user systemd instance]' \ '--user[Operate on user systemd instance]' \
'--global[Show global user instance config]' \
'--no-pager[Do not pipe output into a pager]' \ '--no-pager[Do not pipe output into a pager]' \
'--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \ '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
'--order[When generating graph for dot, show only order]' \ '--order[When generating graph for dot, show only order]' \