]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_systemd-run
improve zsh completion (#32098)
[thirdparty/systemd.git] / shell-completion / zsh / _systemd-run
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 _arguments \
26 '(-G --collect)'{-G,--collect}'[Unload the transient unit after it completed]' \
27 '--description=[Description for unit]:description' \
28 '--gid=[Run as system group]:group:_groups' \
29 '(- *)'{-h,--help}'[Show help message]' \
30 '(-H --host)'{-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
31 '(-M --machine)'{-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \
32 '--nice=[Nice level]:nice level' \
33 '--no-ask-password[Do not query the user for authentication]' \
34 '--no-block[Do not synchronously wait for the unit start operation to finish]' \
35 '--on-active=[Run after SEC seconds]:SEC' \
36 '--on-boot=[Run SEC seconds after machine was booted up]:SEC' \
37 '--on-calendar=[Realtime timer]:SPEC' \
38 '--on-clock-change[Defines a trigger based on system clock jumps]' \
39 '--on-startup=[Run SEC seconds after systemd was first started]:SEC' \
40 '--on-timezone-change[Defines a trigger based on system timezone changes]' \
41 '--on-unit-active=[Run SEC seconds after the last activation]:SEC' \
42 '--on-unit-inactive=[Run SEC seconds after the last deactivation]:SEC' \
43 '--path-property=[Set path unit property]:NAME=VALUE' \
44 '(-P --pipe)'{-P,--pipe}'[Inherit standard input, output, and error]' \
45 '(-p --property)'{-p+,--property=}'[Set unit property]:NAME=VALUE:(( \
46 CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= \
47 SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= \
48 DevicePolicy= KillMode= ExitType= DeviceAllow= BlockIOReadBandwidth= \
49 BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= \
50 KillSignal= RestartKillSignal= FinalKillSignal= LimitCPU= LimitFSIZE= LimitDATA= \
51 LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= \
52 LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= \
53 LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= \
54 PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= \
55 TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= \
56 SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWritePaths= \
57 ReadOnlyPaths= InaccessiblePaths= EnvironmentFile= \
58 ProtectSystem= ProtectHome= RuntimeDirectory= PassEnvironment= \
59 ))' \
60 '(-t --pty)'{-t,--pty}'[The service connects to the terminal]' \
61 '(-q --quiet)'{-q,--quiet}'[Suppresses additional informational output]' \
62 '(-r --remain-after-exit)'{-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
63 '(-d --same-dir)'{-d,--same-dir}'[Run on the current working directory]' \
64 '--scope[Run this as scope rather than service]' \
65 '--send-sighup[Send SIGHUP when terminating]' \
66 '--service-type=[Service type]:type:(simple forking oneshot dbus notify idle)' \
67 '(-E --setenv)'{-E+,--setenv=}'[Set environment]:NAME=VALUE' \
68 '(-S --shell)'{-S,--shell}'[requests an interactive shell in the current working directory]' \
69 '--slice=[Run in the specified slice]:slices:__systemd-run_slices' \
70 '--slice-inherit[Run in the inherited slice]' \
71 '--socket-property=[Set socket unit property]:NAME=VALUE' \
72 '--system[Run as system unit]' \
73 '--timer-property=[Set timer unit property]:NAME=VALUE' \
74 '--uid=[Run as system user]:user:_users' \
75 '(-u --unit)'{-u+,--unit=}'[Run under the specified unit name]:unit name' \
76 '--user[Run as user unit]' \
77 '--version[Show package version]' \
78 '--wait=[Wait until service stopped again]' \
79 '--working-directory=[Run with the specified working directory]' \
80 '(-):command: _command_names -e' \
81 '*::arguments:_normal'