qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/28] qemu-img: refersh options and --help handling, cleanups
@ 2024-02-21 21:15 Michael Tokarev
  2024-02-21 21:15 ` [PATCH 01/28] qemu-img: stop printing error twice in a few places Michael Tokarev
                   ` (27 more replies)
  0 siblings, 28 replies; 49+ messages in thread
From: Michael Tokarev @ 2024-02-21 21:15 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: Michael Tokarev

Quite big patchset trying to implement normal, readable qemu-img --help
(and qemu-img COMMAND --help) output with readable descriptions, and
adding many long options in the process.

In the end I stopped using qemu-img-opts.hx in qemu-img.c, perhaps
this can be avoided, with only list of commands and their desrciptions
kept there, but I don't see big advantage here.  The same list should
be included in docs/tools/qemu-img.rst, - this is not done now.

Also each command syntax isn't reflected in the doc for now, because
I want to give good names for options first, - and there, we've quite
some inconsistences and questions.  For example, measure --output=OFMT
-O OFMT, - this is priceless :)  I've no idea why we have this ugly
--output=json thing, why not have --json? ;)  I gave the desired
format long name --target-format to avoid clash with --output.

For rebase, src vs tgt probably should be renamed in local variables
too, and I'm not even sure I've got the caches right. For caches,
the thing is inconsistent across commands.

For compare, I used --a-format/--b-format (for -f/-F), - this can
be made --souce-format and --target-format, to compare source (file1)
with target (file2).

For bitmap, things are scary, I'm not sure what -b SRC_FILENAME
really means, - for now I gave it --source option, but this does
not make it more clear, suggestions welcome.

There are many other inconsistencies, I can't fix them all in one
go.. :)

Changes since v1:

 - reformatted help text to be less condensed
 - added cleanups (first 3 patches and last patch)
 - change argv[0] handling and getopt error reporting to
   fix inherent bug (see patch 4 "global option processing"
   for details)
 - removed missing_argument() & unrecognized_option()
   and handling of '?' and ':' getopt return values
 - more robust handling of resize filename -size vs options
   ("resize: do not always eat last argument")
 - larger cleanup in snapshot mode handling
   ("snapshot: make -l (list) the default...")
 - cvtnum and number conversion and bugfixes
   ("extend cvtnum() and use it in more places")
 - removed unused option_index variable in two places
 - added a few fixmes
 - various other minor changes

I kept Dan's R-b for a few patches he reviewed
despite the changed, - hopefully it's okay, since
the new changes are not related to the initial ones.
Keeping him in Cc for that.

Michael Tokarev (28):
  qemu-img: stop printing error twice in a few places
  qemu-img: measure: convert img_size to signed, simplify handling
  qemu-img: create: convert img_size to signed, simplify handling
  qemu-img: global option processing and error printing
  qemu-img: pass current cmd info into command handlers
  qemu-img: create: refresh options/--help
  qemu-img: factor out parse_output_format() and use it in the code
  qemu-img: check: refresh options/--help
  qemu-img: simplify --repair error message
  qemu-img: commit: refresh options/--help
  qemu-img: compare: refresh options/--help
  qemu-img: convert: refresh options/--help
  qemu-img: info: refresh options/--help
  qemu-img: map: refresh options/--help
  qemu-img: snapshot: allow specifying -f fmt
  qemu-img: snapshot: make -l (list) the default
  qemu-img: snapshot: refresh options/--help
  qemu-img: rebase: refresh options/--help
  qemu-img: resize: do not always eat last argument
  qemu-img: resize: refresh options/--help
  qemu-img: amend: refresh options/--help
  qemu-img: bench: refresh options/--help
  qemu-img: bitmap: refresh options/--help
  qemu-img: dd: refresh options/--help
  qemu-img: measure: refresh options/--help
  qemu-img: implement short --help, remove global help() function
  qemu-img: inline list of supported commands, remove qemu-img-cmds.h
    include
  qemu-img: extend cvtnum() and use it in more places

 docs/tools/qemu-img.rst |    4 +-
 qemu-img-cmds.hx        |    4 +-
 qemu-img.c              | 1143 +++++++++++++++++++++++----------------
 3 files changed, 670 insertions(+), 481 deletions(-)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2024-02-26 19:17 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 21:15 [PATCH v2 00/28] qemu-img: refersh options and --help handling, cleanups Michael Tokarev
2024-02-21 21:15 ` [PATCH 01/28] qemu-img: stop printing error twice in a few places Michael Tokarev
2024-02-26 14:14   ` Daniel P. Berrangé
2024-02-26 18:58     ` Michael Tokarev
2024-02-26 16:37   ` Michael Tokarev
2024-02-21 21:15 ` [PATCH 02/28] qemu-img: measure: convert img_size to signed, simplify handling Michael Tokarev
2024-02-26 14:19   ` Daniel P. Berrangé
2024-02-21 21:15 ` [PATCH 03/28] qemu-img: create: " Michael Tokarev
2024-02-26 14:19   ` Daniel P. Berrangé
2024-02-21 21:15 ` [PATCH 04/28] qemu-img: global option processing and error printing Michael Tokarev
2024-02-26 14:23   ` Daniel P. Berrangé
2024-02-26 15:40   ` Daniel P. Berrangé
2024-02-21 21:13     ` [PATCH v2.1 " Michael Tokarev
2024-02-26 15:43     ` [PATCH " Michael Tokarev
2024-02-26 16:25       ` Michael Tokarev
2024-02-21 21:15 ` [PATCH 05/28] qemu-img: pass current cmd info into command handlers Michael Tokarev
2024-02-26 14:24   ` Daniel P. Berrangé
2024-02-21 21:15 ` [PATCH 06/28] qemu-img: create: refresh options/--help Michael Tokarev
2024-02-26 14:34   ` Daniel P. Berrangé
2024-02-26 14:37     ` Michael Tokarev
2024-02-21 21:15 ` [PATCH 07/28] qemu-img: factor out parse_output_format() and use it in the code Michael Tokarev
2024-02-21 21:15 ` [PATCH 08/28] qemu-img: check: refresh options/--help Michael Tokarev
2024-02-21 21:15 ` [PATCH 09/28] qemu-img: simplify --repair error message Michael Tokarev
2024-02-21 21:15 ` [PATCH 10/28] qemu-img: commit: refresh options/--help Michael Tokarev
2024-02-21 21:15 ` [PATCH 11/28] qemu-img: compare: " Michael Tokarev
2024-02-21 21:15 ` [PATCH 12/28] qemu-img: convert: " Michael Tokarev
2024-02-21 21:15 ` [PATCH 13/28] qemu-img: info: " Michael Tokarev
2024-02-21 21:15 ` [PATCH 14/28] qemu-img: map: " Michael Tokarev
2024-02-21 21:15 ` [PATCH 15/28] qemu-img: snapshot: allow specifying -f fmt Michael Tokarev
2024-02-21 21:15 ` [PATCH 16/28] qemu-img: snapshot: make -l (list) the default, simplify option handling Michael Tokarev
2024-02-26 14:36   ` Daniel P. Berrangé
2024-02-21 21:15 ` [PATCH 17/28] qemu-img: snapshot: refresh options/--help Michael Tokarev
2024-02-21 21:15 ` [PATCH 18/28] qemu-img: rebase: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 19/28] qemu-img: resize: do not always eat last argument Michael Tokarev
2024-02-26 14:52   ` Daniel P. Berrangé
2024-02-26 14:59     ` Michael Tokarev
2024-02-21 21:16 ` [PATCH 20/28] qemu-img: resize: refresh options/--help Michael Tokarev
2024-02-21 21:16 ` [PATCH 21/28] qemu-img: amend: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 22/28] qemu-img: bench: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 23/28] qemu-img: bitmap: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 24/28] qemu-img: dd: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 25/28] qemu-img: measure: " Michael Tokarev
2024-02-21 21:16 ` [PATCH 26/28] qemu-img: implement short --help, remove global help() function Michael Tokarev
2024-02-26 14:53   ` Daniel P. Berrangé
2024-02-21 21:16 ` [PATCH 27/28] qemu-img: inline list of supported commands, remove qemu-img-cmds.h include Michael Tokarev
2024-02-26 14:54   ` Daniel P. Berrangé
2024-02-21 21:16 ` [PATCH 28/28] qemu-img: extend cvtnum() and use it in more places Michael Tokarev
2024-02-26 14:57   ` Daniel P. Berrangé
2024-02-26 19:16   ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).