qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups
@ 2024-09-27  6:10 Michael Tokarev
  2024-09-27  6:10 ` [PATCH 01/27] qemu-img: measure: convert img_size to signed, simplify handling Michael Tokarev
                   ` (27 more replies)
  0 siblings, 28 replies; 44+ messages in thread
From: Michael Tokarev @ 2024-09-27  6:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Michael Tokarev, Kevin Wolf

This is a re-send of this patchset from Apr-24, after multiple pings.
I rebased it on top of current qemu/master, though nothing has really
changed - it is still the same changes.  We should either apply it or
drop it if it is not appropriate for some reason.  Complete silence
for half a year isn't really nice, I think :)
----

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 v2:

 - added Dan's R-Bs
 - refined couple cvtnum conversions
 - dropped "stop printing error twice in a few places"

Michael Tokarev (27):
  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, simplify option handling
  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                 | 1311 ++++++++++++++++++++++--------------
 tests/qemu-iotests/049.out |    9 +-
 4 files changed, 821 insertions(+), 507 deletions(-)

-- 
2.39.5



^ permalink raw reply	[flat|nested] 44+ messages in thread
* [PATCH v4 00/27] refresh qemu-img options handling
@ 2025-05-31 17:15 Michael Tokarev
  2025-05-31 17:15 ` [PATCH 02/27] qemu-img: create: convert img_size to signed, simplify handling Michael Tokarev
  0 siblings, 1 reply; 44+ messages in thread
From: Michael Tokarev @ 2025-05-31 17:15 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: Michael Tokarev

This is another iteration of this patch series, which tries
to add missing command-line options, --help output, make it
all more or less consistent, etc.

I addressed (hopefully) all comments so far, mostly by Kevin.
I ended up (so far) with a bit different wording somewhere.

The manpage (and the separate documentation) hasn't changed
much, but I intend to use the same wording there as in --help
output.   An example of the separate documentation change is
provided with "create" subcommand only, as a PoC.

I tried to rename a few existing options to make them more
consistent.  This is an RFC, so to say, - I'd love to make
more changes but it isn't really possible because the names
I want to use are already used for different purpose.  All
such changes (3 in total) are marked with "(short option change)"
suffix in the patch subject.  In particular, I tried to use
-b for backing-file, and -B for backing-format, in all places.
Maybe it's too late to change that though.

All subcommands now have --object option.  I wonder why we
haven't done it in common place, before a subcommand.  Maybe
it's a good idea (and I think it is) to add it to the common
(before-subcomman) place, document it there, and remove the
--object mentions from individual commands --help output.

Thanks,

/mjt

Michael Tokarev (27):
  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 (short option change)
  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: use helper function for --object
  qemu-img: compare: refresh options/--help
  qemu-img: convert: refresh options/--help (short option change)
  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, simplify option handling
  qemu-img: snapshot: refresh options/--help
  qemu-img: rebase: refresh options/--help (short option change)
  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: extend cvtnum() and use it in more places

 docs/tools/qemu-img.rst    |   18 +-
 qemu-img-cmds.hx           |    4 +-
 qemu-img.c                 | 1782 +++++++++++++++++++++---------------
 tests/qemu-iotests/049.out |    9 +-
 4 files changed, 1082 insertions(+), 731 deletions(-)

-- 
2.39.5



^ permalink raw reply	[flat|nested] 44+ messages in thread
* [PATCH v3 00/27] qemu-img: refersh options and --help handling, cleanups
@ 2024-04-24  8:50 Michael Tokarev
  2024-04-24  8:50 ` [PATCH 02/27] qemu-img: create: convert img_size to signed, simplify handling Michael Tokarev
  0 siblings, 1 reply; 44+ messages in thread
From: Michael Tokarev @ 2024-04-24  8:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Tokarev, qemu-block

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 v2:

 - added Dan's R-Bs
 - refined couple cvtnum conversions
 - dropped "stop printing error twice in a few places"

Michael Tokarev (27):
  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, simplify option
    handling
  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                 | 1311 ++++++++++++++++++++++--------------
 tests/qemu-iotests/049.out |    9 +-
 4 files changed, 821 insertions(+), 507 deletions(-)

-- 
2.39.2



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

end of thread, other threads:[~2025-06-02 10:46 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27  6:10 [PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups Michael Tokarev
2024-09-27  6:10 ` [PATCH 01/27] qemu-img: measure: convert img_size to signed, simplify handling Michael Tokarev
2024-11-05 19:27   ` Kevin Wolf
2024-09-27  6:10 ` [PATCH 02/27] qemu-img: create: " Michael Tokarev
2024-11-05 19:27   ` Kevin Wolf
2024-09-27  6:10 ` [PATCH 03/27] qemu-img: global option processing and error printing Michael Tokarev
2024-11-05 19:29   ` Kevin Wolf
2024-09-27  6:10 ` [PATCH 04/27] qemu-img: pass current cmd info into command handlers Michael Tokarev
2024-11-05 19:29   ` Kevin Wolf
2024-09-27  6:10 ` [PATCH 05/27] qemu-img: create: refresh options/--help Michael Tokarev
2024-11-05 19:57   ` Kevin Wolf
2024-09-27  6:11 ` [PATCH 06/27] qemu-img: factor out parse_output_format() and use it in the code Michael Tokarev
2025-05-13 15:25   ` Kevin Wolf
2024-09-27  6:11 ` [PATCH 07/27] qemu-img: check: refresh options/--help Michael Tokarev
2025-05-13 15:54   ` Kevin Wolf
2025-05-15  6:50     ` Michael Tokarev
2025-05-15  7:53       ` Kevin Wolf
2025-05-31 16:51     ` Michael Tokarev
2025-06-02 10:44       ` Kevin Wolf
2024-09-27  6:11 ` [PATCH 08/27] qemu-img: simplify --repair error message Michael Tokarev
2025-05-13 16:05   ` Kevin Wolf
2024-09-27  6:11 ` [PATCH 09/27] qemu-img: commit: refresh options/--help Michael Tokarev
2025-05-13 16:24   ` Kevin Wolf
2024-09-27  6:11 ` [PATCH 10/27] qemu-img: compare: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 11/27] qemu-img: convert: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 12/27] qemu-img: info: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 13/27] qemu-img: map: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 14/27] qemu-img: snapshot: allow specifying -f fmt Michael Tokarev
2024-09-27  6:11 ` [PATCH 15/27] qemu-img: snapshot: make -l (list) the default, simplify option handling Michael Tokarev
2024-09-27  6:11 ` [PATCH 16/27] qemu-img: snapshot: refresh options/--help Michael Tokarev
2024-09-27  6:11 ` [PATCH 17/27] qemu-img: rebase: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 18/27] qemu-img: resize: do not always eat last argument Michael Tokarev
2024-09-27  6:11 ` [PATCH 19/27] qemu-img: resize: refresh options/--help Michael Tokarev
2024-09-27  6:11 ` [PATCH 20/27] qemu-img: amend: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 21/27] qemu-img: bench: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 22/27] qemu-img: bitmap: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 23/27] qemu-img: dd: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 24/27] qemu-img: measure: " Michael Tokarev
2024-09-27  6:11 ` [PATCH 25/27] qemu-img: implement short --help, remove global help() function Michael Tokarev
2024-09-27  6:11 ` [PATCH 26/27] qemu-img: inline list of supported commands, remove qemu-img-cmds.h include Michael Tokarev
2024-09-27  6:11 ` [PATCH 27/27] qemu-img: extend cvtnum() and use it in more places Michael Tokarev
2024-10-23  6:15 ` [PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups Michael Tokarev
  -- strict thread matches above, loose matches on Subject: below --
2025-05-31 17:15 [PATCH v4 00/27] refresh qemu-img options handling Michael Tokarev
2025-05-31 17:15 ` [PATCH 02/27] qemu-img: create: convert img_size to signed, simplify handling Michael Tokarev
2024-04-24  8:50 [PATCH v3 00/27] qemu-img: refersh options and --help handling, cleanups Michael Tokarev
2024-04-24  8:50 ` [PATCH 02/27] qemu-img: create: convert img_size to signed, simplify handling 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).