Debian Codegraph @

shell-completion/zsh/_userdbctl

raw
1 #compdef userdbctl
2
3 local context state state_descr line
4 typeset -A opt_args
5 local expl
6 local -a opt_common=(
7 {-h,--help}'[Show a help message and exit]'
8 '--version[Show the package version and exit]'
9 '--no-pager[Do not pipe output into a pager]'
10 '--no-legend[Do not show the headers and footers]'
11 '(-j)--output=[Select output mode]:mode:(classic table friendly json)'
12 '(--output)-j[Equivalent to --output=json]'
13 {-s+,--service=}'[Query the specified service]'
14 '(-N)--with-nss=[Control whether to include glibc NSS data]:bool:(yes no)'
15 '--with-dropin=[Control whether to include drop-in records]:bool:(yes no)'
16 '--with-varlink=[Control whether to talk to services at all]:bool:(yes no)'
17 '(-N)--synthesize=[Synthesize root/nobody user]:bool:(yes no)'
18 '(--with-nss --synthesize)-N[Do not synthesize or include glibc NSS data]'
19 '--multiplexer=[Control whether to use the multiplexer]:bool:(yes no)'
20 '--json=[JSON output mode]:json-mode:(short pretty)'
21 )
22 local -a opt_user_group=(
23 {-z,--fuzzy}'[Do a fuzzy name search]'
24 '*--disposition=[Filter by disposition]:disposition:(intrinsic system regular dynamic container)'
25 '-I[Equivalent to --disposition=intrinsic]'
26 '-S[Equivalent to --disposition=system]'
27 '-R[Equivalent to --disposition=regular]'
28 '--uid-min=[Filter by minimum UID/GID]:uid:_numbers -t uids uid -d 0'
29 '--uid-max=[Filter by maximum UID/GID]:uid:_numbers -t uids uid -d 4294967294'
30 '--uuid=[Filter by UUID]:uuid'
31 '(-B)--boundaries=[Show/hide UID/GID range boundaries in output]:bool:(yes no)'
32 '(--boundaries)-B[Equivalent to --boundaries=no]'
33 {-F+,--from-file=}'[Read JSON record from file]:file:_files'
34 )
35
36 local -a userdbctl_commands=(
37 'user:Inspect user'
38 'group:Inspect group'
39 'users-in-group:Show users that are members of specified groups'
40 'groups-of-user:Show groups the specified users are members of'
41 'services:Show enabled database services'
42 'ssh-authorized-keys:Show SSH authorized keys for user'
43 'load-credentials:Write static user/group records from credentials'
44 )
45
46 local ret=1
47 _arguments -s -A '-*' \
48 "$opt_common[@]" \
49 ':userdbctl command:->command' \
50 '*:: :->option-or-argument' && ret=0
51
52 case $state in
53 command)
54 _describe -t command 'userdbctl command' userdbctl_commands && ret=0
55 ;;
56 option-or-argument)
57 local curcontext=${curcontext%:*:*}:userdbctl-$words[1]:
58 case $words[1] in
59 user)
60 _arguments -s "$opt_common[@]" "$opt_user_group[@]" '*:users:_users' && ret=0
61 ;;
62 groups-of-user)
63 _arguments -s "$opt_common[@]" '*:users:_users' && ret=0
64 ;;
65 group)
66 _arguments -s "$opt_common[@]" "$opt_user_group[@]" '*:groups:_groups' && ret=0
67 ;;
68 users-in-group)
69 _arguments -s "$opt_common[@]" '*:groups:_groups' && ret=0
70 ;;
71 ssh-authorized-keys)
72 _arguments -s "$opt_common[@]" ':users:_users' \
73 '(-):chain:((--chain:"Chain another command"))' \
74 ':command:_absolute_command_paths' \
75 '*: :->chain' && ret=0
76 if [[ $state == chain ]] && compset -N --chain; then
77 _normal && ret=0
78 fi
79 ;;
80 services|load-credentials)
81 _message "no more arguments"
82 ;;
83 esac
84 ;;
85 esac
86 return ret