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