于 2013/10/1 22:49, Eric Blake 写道:
On 09/25/2013 06:16 PM, Wenchao Xia wrote:
Signed-off-by: Wenchao Xia<xiaw...@linux.vnet.ibm.com>
---
  qemu-nbd.c    |   11 ++++++++++-
  qemu-nbd.texi |   11 ++++++++++-
  2 files changed, 20 insertions(+), 2 deletions(-)
This should be squashed into 2/7.  When adding new options, the
documentation should be added at the same time.

  OK.

+"                       the temporary one\n"
+"  -l, --load-snapshot=SNAPSHOT_ID_OR_NAME\n"
+"                       load an internal snapshot inside FILE and export it\n"
+"                       as an read-only device\n"
+"  -L, --load-snapshot1=SNAPSHOT_PARAM\n"
+"                       load an internal snapshot inside FILE and export it\n"
+"                       as an read-only device, SNAPSHOT_PARAM format is\n"
+"                       'snapshot.id=[ID],snapshot.name=[NAME]'\n"
Why can't ONE option be good enough?  In other words, make the command
line parser smart enough so that:

--load-snapshot=name

tries SNAPSHOT_ID_OR_NAME, while

--load-snapshot=snapshot.id=xyz,snapshot.name=name

tries the SNAPSHOT_PARAM form.  In other words, if the optarg begins
with 'snapshot.', assume the SNAPSHOT_PARAM form, otherwise use the
SNAPSHOT_ID_OR_NAME form.  Then you only burn one short option letter,
and avoid the problem with ambiguous abbreviation that I complained
about in 2/7.

  I split the option as two item since want to keep capatiability for
"-s snapshot.id=xyz" in qemu-img convert, it is possible some one already
named a snapshot as "snapshot.id=xyz". But from the comments of Paolo, I think add a new option in qemu-img convert and deprecate -s, can solve the problem,
so I will use your format in next version, thanks for tipping that.



Reply via email to