|
|
572a44 |
From d437087966e4a5f7ad0b37b4254988de41e16228 Mon Sep 17 00:00:00 2001
|
|
|
572a44 |
From: Ronny Chevalier <chevalier.ronny@gmail.com>
|
|
|
572a44 |
Date: Wed, 30 Oct 2013 21:57:44 +0100
|
|
|
572a44 |
Subject: [PATCH] zsh-completion: add systemd-run
|
|
|
572a44 |
|
|
|
572a44 |
---
|
|
|
572a44 |
Makefile.am | 1 +
|
|
|
572a44 |
shell-completion/zsh/_systemd-run | 31 +++++++++++++++++++++++++++++++
|
|
|
572a44 |
2 files changed, 32 insertions(+)
|
|
|
572a44 |
create mode 100644 shell-completion/zsh/_systemd-run
|
|
|
572a44 |
|
|
|
572a44 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
572a44 |
index 8d9c587..0c11477 100644
|
|
|
572a44 |
--- a/Makefile.am
|
|
|
572a44 |
+++ b/Makefile.am
|
|
|
572a44 |
@@ -352,6 +352,7 @@ dist_zshcompletion_DATA = \
|
|
|
572a44 |
shell-completion/zsh/_kernel-install \
|
|
|
572a44 |
shell-completion/zsh/_systemd-nspawn \
|
|
|
572a44 |
shell-completion/zsh/_systemd-analyze \
|
|
|
572a44 |
+ shell-completion/zsh/_systemd-run \
|
|
|
572a44 |
shell-completion/zsh/_sd_hosts_or_user_at_host \
|
|
|
572a44 |
shell-completion/zsh/_systemd-delta \
|
|
|
572a44 |
shell-completion/zsh/_systemd
|
|
|
572a44 |
diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
|
|
|
572a44 |
new file mode 100644
|
|
|
572a44 |
index 0000000..0c81c54
|
|
|
572a44 |
--- /dev/null
|
|
|
572a44 |
+++ b/shell-completion/zsh/_systemd-run
|
|
|
572a44 |
@@ -0,0 +1,31 @@
|
|
|
572a44 |
+#compdef systemd-run
|
|
|
572a44 |
+
|
|
|
572a44 |
+__systemctl() {
|
|
|
572a44 |
+ local -a _modes
|
|
|
572a44 |
+ _modes=("--user" "--system")
|
|
|
572a44 |
+ systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null
|
|
|
572a44 |
+}
|
|
|
572a44 |
+
|
|
|
572a44 |
+__get_slices () {
|
|
|
572a44 |
+ __systemctl list-units --all -t slice \
|
|
|
572a44 |
+ | { while read -r a b; do echo $a; done; };
|
|
|
572a44 |
+}
|
|
|
572a44 |
+
|
|
|
572a44 |
+__slices () {
|
|
|
572a44 |
+ local -a _slices
|
|
|
572a44 |
+ _slices=(${(fo)"$(__get_slices)"})
|
|
|
572a44 |
+ typeset -U _slices
|
|
|
572a44 |
+ _describe 'slices' _slices
|
|
|
572a44 |
+}
|
|
|
572a44 |
+
|
|
|
572a44 |
+_arguments \
|
|
|
572a44 |
+ {-h,--help}'[Show help message]' \
|
|
|
572a44 |
+ '--version[Show package version]' \
|
|
|
572a44 |
+ '--user[Run as user unit]' \
|
|
|
572a44 |
+ '--scope[Run this as scope rather than service]' \
|
|
|
572a44 |
+ '--unit=[Run under the specified unit name]:unit name' \
|
|
|
572a44 |
+ '--description=[Description for unit]:description' \
|
|
|
572a44 |
+ '--slice=[Run in the specified slice]:slices:__slices' \
|
|
|
572a44 |
+ {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
|
|
|
572a44 |
+ '--send-sighup[Send SIGHUP when terminating]' \
|
|
|
572a44 |
+ '*::command:_command'
|