d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier#compdef systemd-run
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier__systemctl() {
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier local -a _modes
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier _modes=("--user" "--system")
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier__get_slices () {
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier __systemctl list-units --all -t slice \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier | { while read -r a b; do echo $a; done; };
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier local -a _slices
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier _slices=(${(fo)"$(__get_slices)"})
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier typeset -U _slices
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier _describe 'slices' _slices
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier {-h,--help}'[Show help message]' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--version[Show package version]' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--user[Run as user unit]' \
f49e8bc4722aa581f655f81b87608709b6bcda38Ronny Chevalier {-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
c0fd7cbd7a3a0aab503393e648b33b6ad49ec485William Giokas {-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--scope[Run this as scope rather than service]' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--unit=[Run under the specified unit name]:unit name' \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu {-p+,--property=}'[Set unit property]:NAME=VALUE:(( \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu KillSignal= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= \
5ffd7671cc122c9bf808104eca7cc96ca3b3d4d1Nicolas Cornu SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWriteDirectories= \
7e7cd2526d9deb7d607854212a1573cff737ce00Nicolas Cornu ReadOnlyDirectories= InaccessibleDirectories= EnvironmentFile= \
b4c14404b3e8753c41bac0b1d49369230a15c544Filipe Brandenburger ProtectSystem= ProtectHome= RuntimeDirectory= PassEnvironment= \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--description=[Description for unit]:description' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--slice=[Run in the specified slice]:slices:__slices' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '--send-sighup[Send SIGHUP when terminating]' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--service-type=[Service type]:type:(simple forking oneshot dbus notify idle)' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--uid=[Run as system user]:user:_users' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--gid=[Run as system group]:group:_groups' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--nice=[Nice level]:nice level' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--setenv=[Set environment]:NAME=VALUE' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-active=[Run after SEC seconds]:SEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-boot=[Run after SEC seconds from machine was booted up]:SEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-statup=[Run after SEC seconds from systemd was first started]:SEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-unit-active=[Run after SEC seconds from the last activation]:SEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-unit-inactive=[Run after SEC seconds from the last deactivation]:SEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--on-calendar=[Realtime timer]:SPEC' \
a80cea68616df5991ed64ed93f956d4377974a21Ronny Chevalier '--timer-property=[Set timer unit property]:NAME=VALUE' \
d74ab852161d2dc4093d369495ddfa18460cfd76Ronny Chevalier '*::command:_command'