Ah, completely missed images. So perhaps something like this would be
better?

machinectl --full --no-legend --no-pager list-images | awk '{print $1}'

as this lists

fedora
fedora-rawhide

instead of

fedora.raw
fedora-rawhide

However this will break if one has spaces in the container name. I would
delimit awk by a tab, but it seems list-images doesn't delimit by tabs. So
I'm not sure what the best solution would be as something like this, "ls -1
/var/lib/container | sed 's|\.raw||g'" seems kind of silly.

(Apologies for sending twice. I missed the CC)

On Wed, Apr 22, 2015 at 11:20 AM, Lennart Poettering <lenn...@poettering.net
> wrote:

> On Wed, 22.04.15 11:07, Lukas Rusak (loru...@gmail.com) wrote:
>
> > ---
> >  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..2b1b7ed 100644
> > --- a/shell-completion/zsh/_machinectl
> > +++ b/shell-completion/zsh/_machinectl
> > @@ -1,5 +1,20 @@
> >  #compdef machinectl
> >
> > +__get_available_machines () {
> > +    ls -1 /var/lib/container |  {while read -r a b; do echo $a; done;}
> > +}
>
> Hmm, the right way to list running containers is with "machinectl
> list". The right way to list container images is with "machinectl
> list-images".
>
> Just listing /var/lib/container is not right, because the we tent to
> prefer /var/lib/machines now, and because we support raw images in
> those dirs, which carry the ".raw" suffix which should be removed when
> used as machine name.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to