On 10/21/2015 06:26 AM, Eric Blake wrote: >> In this case migrate help is printed out. So far so good. >> However, you start writing this long migrate command (I bet you >> know the arguments there can get quite long), but then, at some >> point you need to print out the help. Something like this: >> >> virsh # migrate --copy-storage-all --migrate-disks --help >> >> In this specific case you just want to see the format that >> --migrate-disks accepts. So you append --help and expect help to >> be printed out. Well, it will not, because "--help" is taken as >> data to --migrate-disks. > > But this is the behavior of ALL applications that use getopt_long(): > > $ ls --block-size --help > ls: invalid --block-size argument '--help' > > NACK; if you use --help in the position where it will be eaten as the > argument to an incomplete long option, that's too bad for you, but we > shouldn't special case it differently than getopt_long(). By the way, you CAN get in the habit of typing '--help --help' any time you want help but don't know if the first --help will just end up as filler to an incomplete option. It doesn't globally work, but happens to work for virsh. For 'virsh migrate --copy-storage-all --migrate-disks --help --help', we get help output (since we do all option parsing before any interpretation of the options, then make sure to interpret --help before any other option once --help is seen in an option position). Whereas with my ls example, 'ls --block-size --help --help' doesn't work; arguably something that could be patched in coreutils to be more user-friendly but not our problem here. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list