On Tue, Oct 20, 2020 at 15:02:07 +0200, Michal Privoznik wrote:
On 10/20/20 2:46 PM, Peter Krempa wrote:
> On Tue, Oct 20, 2020 at 12:27:27 +0200, Michal Privoznik wrote:
> > Some completers for libvirt related tools might want to list
> > domain IDs only. Just like the one I've implemented for
> > virt-viewer [1]. I've worked around it using some awk magic,
> > but if it was possible to just 'virsh list --id' then I could
> > drop awk.
>
> IMO completing numeric IDs doesn't make much sense, they aren't
> descriptive at all and I don't really see a point for users using them
> on a commandline. If you are expanding both names and IDs then you'll
> have twice as much completion suggestions on an empty string.
>
> Is there a case where it would actually make sense? Specifically in
> virsh we almost always accept id/name/UUID interchangably for a
> 'domain'.
>
As I'm saying in the commit message - virt-viewer accepts --id, I don't
expect ID completer to ever be implemented for virsh because as you say,
domnames and/or uuids are accepted universally.
Okay, I've seen that you've mentioned the completer for virt-viewer but
I didn't realize it has an explicit --id. It makes sense though since VM
name allows numeric names, so if a completer suggests both names and ids
it might end up very confusing.
A potential alternative resolution to my other reply reviewing the code
would be to make 'virsh list --id' mutually exclusive with '--name' or
'--uuid'. That would make it usable with a completer completing IDs and
wouldn't hopefully give anyone false ideas of using it to fetch all 3
identifiers for completion.