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