On 16.05.2011 10:56, Daniel P. Berrange wrote: > On Fri, May 13, 2011 at 05:18:27PM -0600, Eric Blake wrote: >> On 05/13/2011 03:16 AM, Daniel P. Berrange wrote: >>> On Thu, May 12, 2011 at 06:29:12PM +0200, Michal Privoznik wrote: >>>> +static const vshCmdOptDef opts_screenshot[] = { >>>> + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, >>>> + {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("where to store the screenshot")}, >>>> + {"screen", VSH_OT_INT, 0, N_("ID of a screen to take screenshot of")}, >>>> + {NULL, 0, 0, NULL} >>>> +}; >>>> + >> >>> I think it would be better if 'screenID' was a flag instead of a >>> positional parameter, eg >>> >>> screenshot --screen 1 myguest imagefile.png >> >> But virsh _already_ handles all named arguments in any order. That is, >> >> screenshot --screen 1 myguest imagefile.png >> screenshot myguest imagefile.png 1 >> >> are identical, at least with the above opts_screenshot (thanks to commit >> b9973f5). > > I don't see how that could work, if you want to make filename > optional. Since if you have > > screenshot myguest 1 This is now understand as: take screenshot of myguest, screenID=0 (by default) and store it into file named '1'. Running 'screenshot --screen 1 f14' would produce an error: <file> required. I agree not to make arguments positional, and basically screenID is not. It is an added value that it can be specified as 3rd argument. If we make --file optional (and generate it), this will still work as expected: 'screenshot --screen 1 f14' would not produce any error but file instead. Moreover, screenshot f14 would take screenshot of screenID=0 and store it into file with generated file. > > it can't determine whether '1' is a screen number or filename. Thus > we have to use --screen for this > > Daniel Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list