
-----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Wednesday, November 13, 2013 9:14 PM To: Chen Hanxiao; libvir-list@redhat.com Subject: Re: [libvirt] [PATCH v2]virsh: track alias option and improve error message when option duplicates its alias
In addition to Peter's review, it helps if you make your commit message smarter by showing before-and-after scenarios, to make it obvious how the error message improved. My quick testing of the 4 possible 'before' scenarios:
$ args="-c test:///default attach-disk test /dev/null vda" $ tools/virsh $args --shareable --shareable error: option --mode already seen $ tools/virsh $args --shareable --mode=shareable error: option --mode already seen $ tools/virsh $args --mode=shareable --mode=shareable error: option --mode already seen $ tools/virsh $args --mode=shareable --shareable error: option --mode already seen
Thanks for your advice.
The existing message of "--mode already seen" is absolutely confusing for scenario 1, correct for scenario 3, and sort of confusing for scenarios 2 and 4. Your proposed message of "'--shareable' duplicates its alias '--mode'" would be wrong for scenarios 1 and 3, but works for scenarios 2 and 4. Are you improving the message for one scenario at the expense of a regression in quality of other scenarios?
I lacked of test cases about two same parameters.
Furthermore, since aliases are (mostly) undocumented, the ONLY people that should be using them are historical scripts that already had a working command line, and not new users trying to experiment with the various options; and working command lines don't have a problem with duplicate options. I think you're trying to address a non-issue. Since neither the '--help' text nor tab completion should be offering an alias as a preferred spelling in the first place, it's unlikely that a human user is going to be attempting a collision between its alias and the canonical spelling.
Thanks, I see. If we can get rid of auto completion of alias, I think it will be fine enough.
I'm inclined to just say leave good enough alone, without trying to make any further "improvements", as we have reached the point of diminishing returns.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org