<div dir="ltr">I feel like this is already accomplished. The completion function "_sd_machines" already lists the running containers.<div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Otherwise currently "</span><span style="font-size:12.8000001907349px">_available_machines"</span><span style="font-size:12.8000001907349px"> is only used for "machinectl start".</span></div><div>see,</div><div><div style><span style="font-size:12.8000001907349px">          list*|cancel-transfer|pull-tar|pull-raw|pull-dkr)</span></div><div style><span style="font-size:12.8000001907349px">            msg="no options" ;;</span></div><div style><span style="font-size:12.8000001907349px">          start)</span></div><div style><span style="font-size:12.8000001907349px">            _available_machines ;;</span></div><div style><span style="font-size:12.8000001907349px">          *)</span></div><div style><span style="font-size:12.8000001907349px">            _sd_machines</span></div></div><div style><span style="font-size:12.8000001907349px"><br></span></div><div style><span style="font-size:12.8000001907349px">All other functions (other than </span><span style="font-size:12.8000001907349px">list-images, list-transfers, list, cancel-transfer, pull-tar, pull-raw, and pull-dkr) use the already implemented "</span><span style="font-size:12.8000001907349px">_sd_machines" function to list currently running machines.</span></div><div style><span style="font-size:12.8000001907349px"><br></span></div><div style><span style="font-size:12.8000001907349px">So, i</span>f you would like I can change "<span style="font-size:12.8000001907349px">_available_machines" to "</span><span style="font-size:12.8000001907349px">_available_images" and "</span><span style="font-size:12.8000001907349px">__get_available_machines" to "</span><span style="font-size:12.8000001907349px">__get_available_images" if this makes more sense.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 23, 2015 at 7:53 AM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, 22.04.15 15:52, Lukas Rusak (<a href="mailto:lorusak@gmail.com">lorusak@gmail.com</a>) wrote:<br>
<br>
> Appologies, I'm still getting used to this mailing list thing and using git send-email<br>
><br>
> ---<br>
>  shell-completion/zsh/_machinectl | 84 +++++++++++++++++++++++++++++++++-------<br>
>  1 file changed, 70 insertions(+), 14 deletions(-)<br>
><br>
> diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl<br>
> index c666b7e..a81c5c7 100644<br>
> --- a/shell-completion/zsh/_machinectl<br>
> +++ b/shell-completion/zsh/_machinectl<br>
> @@ -1,5 +1,20 @@<br>
>  #compdef machinectl<br>
><br>
> +__get_available_machines () {<br>
> +    machinectl --no-legend list-images | awk '{print $1}' |  {while read -r a b; do echo $a; done;}<br>
> +}<br>
> +<br>
> +_available_machines() {<br>
> +    local -a _machines<br>
> +    _machines=("${(fo)$(__get_available_machines)}")<br>
> +    typeset -U _machines<br>
> +    if [[ -n "$_machines" ]]; then<br>
> +        _describe 'machines' _machines<br>
> +    else<br>
> +     _message 'no machines'<br>
> +    fi<br>
> +}<br>
<br>
</div></div>For this to be fully correct, you need to distuingish "images" and<br>
"machines".<br>
<br>
Basically, "machines" are runtime objects, instances of containers<br>
currently running. "images" are files or directories on disk. You can<br>
run multiple machines off the same image (by use --read-only or<br>
--ephemeral).<br>
<br>
Other container/VM managers like libvirt-lxc also register their<br>
running containers with machined as machines, even though the backing<br>
images of those machines might not be visible to machined.<br>
<br>
Usually you run a machine from an image that carries the same name as<br>
the image, but that's not a requirement really.<br>
<br>
Some of machinectl's commands operate on images, others on running<br>
containers...<br>
<div class="HOEnZb"><div class="h5"><br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
</div></div></blockquote></div><br></div>