From b76c90d451c08508716ab7a7f07dc11199583dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 21 Jul 2014 21:11:56 -0400 Subject: [PATCH] shell-completion: systemd-analyze verify, systemctl link Some zsh completion helpers were not installed, so completion was broken. Add systemd-analyze verify. Make systemctl link complete only unit names. (cherry picked from commit 2c12a402cb1e8277c271ced8dc9c06d20b8f6017) Conflicts: TODO [backport: undo verify and busname changes] --- Makefile.am | 2 ++ shell-completion/zsh/_sd_unit_files | 9 +++++++++ shell-completion/zsh/_systemctl.in | 4 +++- shell-completion/zsh/_systemd-analyze | 7 ++++++- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 shell-completion/zsh/_sd_unit_files diff --git a/Makefile.am b/Makefile.am index 5cc5c7ce5..d61838e6f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -362,6 +362,8 @@ dist_zshcompletion_DATA = \ shell-completion/zsh/_systemd-analyze \ shell-completion/zsh/_systemd-run \ shell-completion/zsh/_sd_hosts_or_user_at_host \ + shell-completion/zsh/_sd_outputmodes \ + shell-completion/zsh/_sd_unit_files \ shell-completion/zsh/_systemd-delta \ shell-completion/zsh/_systemd diff --git a/shell-completion/zsh/_sd_unit_files b/shell-completion/zsh/_sd_unit_files new file mode 100644 index 000000000..4778a0420 --- /dev/null +++ b/shell-completion/zsh/_sd_unit_files @@ -0,0 +1,9 @@ +#autoload + +_sd_unit_files() { + local files expl + files=( '*:files:->files' ) + + _description files expl 'unit file' + _files "$expl[@]" -g '*.(automount|busname|device|mount|path|service|snapshot|socket|swap|target|timer)' +} diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 0652349d5..0c27ab1d9 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -259,7 +259,9 @@ for fun in set-environment unset-environment ; do } done -(( $+functions[_systemctl_link] )) || _systemctl_link() { _files } +(( $+functions[_systemctl_link] )) || _systemctl_link() { + _sd_unit_files +} # no systemctl completion for: # [STANDALONE]='daemon-reexec daemon-reload default diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze index 2eda5fe8a..d82e226ff 100644 --- a/shell-completion/zsh/_systemd-analyze +++ b/shell-completion/zsh/_systemd-analyze @@ -38,7 +38,12 @@ _systemd_analyze_command(){ _arguments \ {-h,--help}'[Show help text.]' \ - '--user[Shows performance data of user sessions instead of the system manager.]' \ + '--system[Operate on system systemd instance.]' \ + '--user[Operate on user systemd instance.]' \ + '--no-pager[Do not user pager.]' \ + '--no-man[Do not check man pages.]' \ '--order[When generating graph for dot, show only order]' \ '--require[When generating graph for dot, show only requirement]' \ + {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ + {-M+,--machine=}'[Operate on local container]:machine' \ '*::systemd-analyze commands:_systemd_analyze_command'