All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH 14/27] qemu-img: map: refresh options/--help
Date: Tue, 15 Jul 2025 15:07:42 +0200	[thread overview]
Message-ID: <aHZSnnkEftTBOY4l@redhat.com> (raw)
In-Reply-To: <20250531171609.197078-15-mjt@tls.msk.ru>

Am 31.05.2025 um 19:15 hat Michael Tokarev geschrieben:
> Add missing long options and --help output,
> reorder options for consistency.
> 
> While at it, remove unused option_index variable.
> 
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  qemu-img.c | 57 ++++++++++++++++++++++++++++++++++--------------------
>  1 file changed, 36 insertions(+), 21 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index f0d04a874d..f5820a7017 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3451,41 +3451,51 @@ static int img_map(const img_cmd_t *ccmd, int argc, char **argv)
>  
>      fmt = NULL;
>      for (;;) {
> -        int option_index = 0;
>          static const struct option long_options[] = {
>              {"help", no_argument, 0, 'h'},
>              {"format", required_argument, 0, 'f'},
> -            {"output", required_argument, 0, OPTION_OUTPUT},
> -            {"object", required_argument, 0, OPTION_OBJECT},
>              {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
> -            {"force-share", no_argument, 0, 'U'},
>              {"start-offset", required_argument, 0, 's'},
>              {"max-length", required_argument, 0, 'l'},
> +            {"force-share", no_argument, 0, 'U'},
> +            {"output", required_argument, 0, OPTION_OUTPUT},
> +            {"object", required_argument, 0, OPTION_OBJECT},
>              {0, 0, 0, 0}
>          };
> -        c = getopt_long(argc, argv, ":f:s:l:hU",
> -                        long_options, &option_index);
> +        c = getopt_long(argc, argv, "hf:s:l:U",
> +                        long_options, NULL);
>          if (c == -1) {
>              break;
>          }
>          switch (c) {
> -        case ':':
> -            missing_argument(argv[optind - 1]);
> -            break;
> -        case '?':
> -            unrecognized_option(argv[optind - 1]);
> -            break;
>          case 'h':
> -            help();
> +            cmd_help(ccmd, "[-f FMT | --image-opts]\n"
> +"        [--start-offset OFFSET] [--max-length LENGTH]\n"
> +"        [--output human|json] [-U] [--object OBJDEF] FILE\n"
> +,
> +"  -f, --format FMT\n"
> +"     specify FILE image format explicitly (default: probing is used)\n"
> +"  --image-opts\n"
> +"     treat FILE as an option string (key=value,..), not a file name\n"
> +"     (incompatible with -f|--format)\n"
> +"  --start-offset OFFSET\n"

-s, --start-offset

> +"  --max-length LENGTH\n"

-l, --max-length

> +"  --output human|json\n"
> +"     specify output format name (default: human)\n"
> +"  -U, --force-share\n"
> +"     open image in shared mode for concurrent access\n"
> +"  --object OBJDEF\n"
> +"     defines QEMU user-creatable object\n"
> +"  FILE\n"
> +"     the image file name, or option string (key=value,..)\n"
> +"     with --image-opts, to operate on\n"
> +);

Kevin



  reply	other threads:[~2025-07-15 13:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-31 17:15 [PATCH v4 00/27] refresh qemu-img options handling Michael Tokarev
2025-05-31 17:15 ` [PATCH 01/27] qemu-img: measure: convert img_size to signed, simplify handling Michael Tokarev
2025-05-31 17:15 ` [PATCH 02/27] qemu-img: create: " Michael Tokarev
2025-05-31 17:15 ` [PATCH 03/27] qemu-img: global option processing and error printing Michael Tokarev
2025-05-31 17:15 ` [PATCH 04/27] qemu-img: pass current cmd info into command handlers Michael Tokarev
2025-05-31 17:15 ` [PATCH 05/27] qemu-img: create: refresh options/--help (short option change) Michael Tokarev
2025-05-31 17:15 ` [PATCH 06/27] qemu-img: factor out parse_output_format() and use it in the code Michael Tokarev
2025-05-31 17:15 ` [PATCH 07/27] qemu-img: check: refresh options/--help Michael Tokarev
2025-05-31 17:15 ` [PATCH 08/27] qemu-img: simplify --repair error message Michael Tokarev
2025-05-31 17:15 ` [PATCH 09/27] qemu-img: commit: refresh options/--help Michael Tokarev
2025-05-31 17:15 ` [PATCH 10/27] qemu-img: compare: use helper function for --object Michael Tokarev
2025-05-31 17:15 ` [PATCH 11/27] qemu-img: compare: refresh options/--help Michael Tokarev
2025-05-31 17:15 ` [PATCH 12/27] qemu-img: convert: refresh options/--help (short option change) Michael Tokarev
2025-07-15 14:07   ` Michael Tokarev
2025-05-31 17:15 ` [PATCH 13/27] qemu-img: info: refresh options/--help Michael Tokarev
2025-07-15 13:04   ` Kevin Wolf
2025-05-31 17:15 ` [PATCH 14/27] qemu-img: map: " Michael Tokarev
2025-07-15 13:07   ` Kevin Wolf [this message]
2025-07-15 13:50     ` Michael Tokarev
2025-07-15 14:09   ` Michael Tokarev
2025-05-31 17:15 ` [PATCH 15/27] qemu-img: snapshot: allow specifying -f fmt Michael Tokarev
2025-05-31 17:15 ` [PATCH 16/27] qemu-img: snapshot: make -l (list) the default, simplify option handling Michael Tokarev
2025-05-31 17:15 ` [PATCH 17/27] qemu-img: snapshot: refresh options/--help Michael Tokarev
2025-05-31 17:16 ` [PATCH 18/27] qemu-img: rebase: refresh options/--help (short option change) Michael Tokarev
2025-05-31 17:16 ` [PATCH 19/27] qemu-img: resize: do not always eat last argument Michael Tokarev
2025-05-31 17:16 ` [PATCH 20/27] qemu-img: resize: refresh options/--help Michael Tokarev
2025-05-31 17:16 ` [PATCH 21/27] qemu-img: amend: " Michael Tokarev
2025-05-31 17:16 ` [PATCH 22/27] qemu-img: bench: " Michael Tokarev
2025-05-31 17:16 ` [PATCH 23/27] qemu-img: bitmap: " Michael Tokarev
2025-05-31 17:16 ` [PATCH 24/27] qemu-img: dd: " Michael Tokarev
2025-05-31 17:16 ` [PATCH 25/27] qemu-img: measure: " Michael Tokarev
2025-05-31 17:16 ` [PATCH 26/27] qemu-img: implement short --help, remove global help() function Michael Tokarev
2025-05-31 17:16 ` [PATCH 27/27] qemu-img: extend cvtnum() and use it in more places Michael Tokarev
2025-06-23  9:15 ` [PATCH v4 00/27] refresh qemu-img options handling Michael Tokarev
2025-07-15 18:42 ` Kevin Wolf
2025-07-17  8:27   ` Michael Tokarev
2025-07-17 16:01     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aHZSnnkEftTBOY4l@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.