chiark / gitweb /
0c81c543c5884751871aeb2d3f2db27fd241855f
[elogind.git] / shell-completion / zsh / _systemd-run
1 #compdef systemd-run
2
3 __systemctl() {
4         local -a _modes
5         _modes=("--user" "--system")
6         systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null
7 }
8
9 __get_slices () {
10         __systemctl list-units --all -t slice \
11         | { while read -r a b; do echo $a; done; };
12 }
13
14 __slices () {
15         local -a _slices
16         _slices=(${(fo)"$(__get_slices)"})
17         typeset -U _slices
18         _describe 'slices' _slices
19 }
20
21 _arguments \
22         {-h,--help}'[Show help message]' \
23         '--version[Show package version]' \
24         '--user[Run as user unit]' \
25         '--scope[Run this as scope rather than service]' \
26         '--unit=[Run under the specified unit name]:unit name' \
27         '--description=[Description for unit]:description' \
28         '--slice=[Run in the specified slice]:slices:__slices' \
29         {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
30         '--send-sighup[Send SIGHUP when terminating]' \
31         '*::command:_command'