[systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run
William Giokas
1007380 at gmail.com
Thu Oct 31 21:24:48 CET 2013
On Thu, Oct 31, 2013 at 08:46:29PM +0100, Ronny Chevalier wrote:
> ---
> shell-completion/zsh/_systemd-run | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
> index 0c81c54..4bfbd19 100644
> --- a/shell-completion/zsh/_systemd-run
> +++ b/shell-completion/zsh/_systemd-run
> @@ -18,10 +18,27 @@ __slices () {
> _describe 'slices' _slices
> }
>
> +__get_machines () {
> + machinectl --full --no-pager list | {while read -r a b; do echo $a; done;};
> +}
> +
> +__machines () {
> + local -a _machines
> + _machines=("${(fo)$(__get_machines)}")
> + typeset -U _machines
> + if [[ -n "$_machines" ]]; then
> + _describe 'machines' _machines
> + else
> + _message 'no machines'
> + fi
> +}
> +
Much better. Now one thing that would make this amazing is if you could
make __machines an autoloaded file, possibly _sd_machines, that can be
used in multiple zsh completions so that work doesn't have to be
duplicated between this and _machinectl, similar to the work done with
_sd_hosts_or_user_at_host. And possibly split this into two patches, one
that just adds the -H/--host line and another that adds the -M/--machine
line, the _sd_machines file and has _machinectl use _sd_machines.
Just a thought.
> _arguments \
> {-h,--help}'[Show help message]' \
> '--version[Show package version]' \
> '--user[Run as user unit]' \
> + {-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
> + {-M+,--machine=}'[Operate on local container]:machines:__machines' \
> '--scope[Run this as scope rather than service]' \
> '--unit=[Run under the specified unit name]:unit name' \
> '--description=[Description for unit]:description' \
> --
> 1.8.4.2
Thanks,
--
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306 E6B8 6902 06D8 73CD 09CF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131031/15abdfe0/attachment.pgp>
More information about the systemd-devel
mailing list