summaryrefslogtreecommitdiff
path: root/shell-completion/zsh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-14 19:24:46 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-15 10:06:12 -0400
commitc0a67aef31bb9716617ffe150ca8be19c5df203e (patch)
tree51b6df6293f4a069e14747b8d84936e1b1e97ec5 /shell-completion/zsh
parentae2db4e7e868fb89f5053a962a3a43337ddfd4e0 (diff)
shell-completion: restore completion for -p
It was broken since systemd was moved out of /bin. For zsh it was never there.
Diffstat (limited to 'shell-completion/zsh')
-rw-r--r--shell-completion/zsh/.gitignore1
-rw-r--r--shell-completion/zsh/_systemctl.in (renamed from shell-completion/zsh/_systemctl)15
2 files changed, 15 insertions, 1 deletions
diff --git a/shell-completion/zsh/.gitignore b/shell-completion/zsh/.gitignore
new file mode 100644
index 0000000000..75f13ad6d1
--- /dev/null
+++ b/shell-completion/zsh/.gitignore
@@ -0,0 +1 @@
+/_systemctl
diff --git a/shell-completion/zsh/_systemctl b/shell-completion/zsh/_systemctl.in
index b6cf664587..d9b8d1c0e3 100644
--- a/shell-completion/zsh/_systemctl
+++ b/shell-completion/zsh/_systemctl.in
@@ -301,12 +301,25 @@ _unit_types() {
_values -s , "${_types[@]}"
}
+_unit_properties() {
+ if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES ) &&
+ ! _retrieve_cache SYS_ALL_PROPERTIES;
+ then
+ _sys_all_properties=( $( {__systemctl show --all;
+ @rootlibexecdir@/systemd --dump-configuration-items; } | {
+ while IFS='=' read -r a b; do [ -n "$b" ] && echo "$a"; done
+ }) )
+ _store_cache SYS_ALL_PROPRTIES _sys_all_properties
+ fi
+ _values -s , "${_sys_all_properties[@]}"
+}
+
_arguments -s \
{-h,--help}'[Show help]' \
'--version[Show package version]' \
{-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
'--state=[Display units in the specifyied state]:unit state:_unit_states' \
- \*{-p+,--property=}'[Show only properties by specific name]:unit property' \
+ {-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \
{-a,--all}'[Show all units/properties, including dead/empty ones]' \
'--reverse[Show reverse dependencies]' \
'--after[Show units ordered after]' \