[PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups

Michael Tokarev posted 27 patches 1 month, 3 weeks ago
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(-)
[PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups
Posted by Michael Tokarev 1 month, 3 weeks ago
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
Re: [PATCH resend v3 00/27] qemu-img: refersh options and --help handling, cleanups
Posted by Michael Tokarev 1 month ago
Ping #5?

Thanks,

/mjt

27.09.2024 09:10, Michael Tokarev wrote:
> 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(-)
> 

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt