Debian Codegraph @

shell-completion/zsh/_systemd-run

raw
1 #compdef systemd-run
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3
4 # @todo _systemctl has a helper with the same name, so we must redefine
5 __systemctl() {
6 local -a _modes
7 _modes=("--user" "--system")
8 systemctl ${words:*_modes} --full --no-legend --no-pager --plain "$@" 2>/dev/null
9 }
10
11 (( $+functions[__systemd-run_get_slices] )) ||
12 __systemd-run_get_slices () {
13 __systemctl list-units --all -t slice |
14 { while read -r a b; do echo $a; done; }
15 }
16
17 (( $+functions[__systemd-run_slices] )) ||
18 __systemd-run_slices () {
19 local -a _slices
20 _slices=(${(fo)"$(__systemd-run_get_slices)"})
21 typeset -U _slices
22 _describe 'slices' _slices
23 }
24
25 (( $+functions[_systemd-run_job_modes] )) ||
26 _systemd-run_job_modes() {
27 local -a _modes
28 _modes=($( systemd-run --job-mode=help 2>/dev/null ))
29 _values "${_modes[@]}"
30 }
31
32 (( $+functions[_systemd-run_properties] )) ||
33 _systemd-run_properties() {
34 local -a _properties
35 _properties=($( systemd-analyze transient-settings scope service 2>/dev/null |
36 while read -r p; do [ -z "$p" ] || echo "$p="; done ))
37 _values 'NAME=VALUE' "${_properties[@]}"
38 }
39
40 (( $+functions[_systemd-run_path-properties] )) ||
41 _systemd-run_path-properties() {
42 local -a _properties
43 _properties=($( systemd-analyze transient-settings path 2>/dev/null |
44 while read -r p; do [ -z "$p" ] || echo "$p="; done ))
45 _values 'NAME=VALUE' "${_properties[@]}"
46 }
47
48 (( $+functions[_systemd-run_socket-properties] )) ||
49 _systemd-run_socket-properties() {
50 local -a _properties
51 _properties=($( systemd-analyze transient-settings socket 2>/dev/null |
52 while read -r p; do [ -z "$p" ] || echo "$p="; done ))
53 _values 'NAME=VALUE' "${_properties[@]}"
54 }
55
56 (( $+functions[_systemd-run_timer-properties] )) ||
57 _systemd-run_timer-properties() {
58 local -a _properties
59 _properties=($( systemd-analyze transient-settings timer 2>/dev/null |
60 while read -r p; do [ -z "$p" ] || echo "$p="; done ))
61 _values 'NAME=VALUE' "${_properties[@]}"
62 }
63
64 _arguments \
65 '(-G --collect --shell)'{-G,--collect}'[Unload the transient unit after it completed]' \
66 '--description=[Description for unit]:description' \
67 '--gid=[Run as system group]:group:_groups' \
68 '(- *)'{-h,--help}'[Show help message]' \
69 '(-H --host)'{-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
70 '(-M --machine)'{-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \
71 '(-C --capsule)'{-C,--capsule=}'[Operate on capsule]:capsule' \
72 '--nice=[Nice level]:nice level' \
73 '--no-ask-password[Do not query the user for authentication]' \
74 '--no-pager[Do not spawn a pager]' \
75 '(--wait)--no-block[Do not synchronously wait for the unit start operation to finish]' \
76 '--on-active=[Run after SEC seconds]:SEC' \
77 '--on-boot=[Run SEC seconds after machine was booted up]:SEC' \
78 '--on-calendar=[Realtime timer]:SPEC' \
79 '--on-clock-change[Defines a trigger based on system clock jumps]' \
80 '--on-startup=[Run SEC seconds after systemd was first started]:SEC' \
81 '--on-timezone-change[Defines a trigger based on system timezone changes]' \
82 '--on-unit-active=[Run SEC seconds after the last activation]:SEC' \
83 '--on-unit-inactive=[Run SEC seconds after the last deactivation]:SEC' \
84 '--path-property=[Set path unit property]:NAME=VALUE:_systemd-run_path-properties' \
85 '(-P --pipe)'{-P,--pipe}'[Inherit standard input, output, and error]' \
86 {'*-p+','*--property='}'[Set unit property]:NAME=VALUE:_systemd-run_properties' \
87 '(-t --pty --shell)'{-t,--pty}'[The service connects to the terminal]' \
88 '(-q --quiet)'{-q,--quiet}'[Suppresses additional informational output]' \
89 '--json=[Output as JSON]:JSON:(pretty short off)' \
90 '--job-mode=[Specify how to deal with other jobs]:mode:_systemd-run_job_modes' \
91 '(-r --remain-after-exit)'{-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
92 '(-d --same-dir --working-directory --shell)'{-d,--same-dir}'[Run on the current working directory]' \
93 '--scope[Run this as scope rather than service]' \
94 '--send-sighup[Send SIGHUP when terminating]' \
95 '(--shell)--service-type=[Service type]:type:(simple forking oneshot dbus notify idle)' \
96 {'*-E+','*--setenv='}'[Set environment]:NAME=VALUE' \
97 '(-S --shell --pty --same-dir --wait --collect --service-type)'{-S,--shell}'[requests an interactive shell in the current working directory]' \
98 '--slice=[Run in the specified slice]:slices:__systemd-run_slices' \
99 '--slice-inherit[Run in the inherited slice]' \
100 '--expand-environment=[Control expansion of environment variables]:bool:(yes no)' \
101 '--socket-property=[Set socket unit property]:NAME=VALUE:_systemd-run_socket-properties' \
102 '(--user)--system[Run as system unit]' \
103 '--timer-property=[Set timer unit property]:NAME=VALUE:_systemd-run_timer-properties' \
104 '--uid=[Run as system user]:user:_users' \
105 '(-u --unit)'{-u+,--unit=}'[Run under the specified unit name]:unit name' \
106 '(--system)--user[Run as user unit]' \
107 '(- *)--version[Show package version]' \
108 '(--no-block --shell)--wait[Wait until service stopped again]' \
109 '(--same-dir -d --shell)--working-directory=[Run with the specified working directory]:dir:_files -/' \
110 '(-):command: _command_names -e' \
111 '*::arguments:_normal'