[systemd-devel] [PATCH 1/3] zsh-completion: add missing completions for machinectl
Lukas Rusak
lorusak at gmail.com
Wed Apr 22 12:30:32 PDT 2015
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 <lennart at poettering.net
> wrote:
> On Wed, 22.04.15 11:07, Lukas Rusak (lorusak at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150422/4a07c504/attachment.html>
More information about the systemd-devel
mailing list