Am 27.09.2024 um 08:11 hat Michael Tokarev geschrieben:
> Use common code and simplify error message
> 
> Signed-off-by: Michael Tokarev <m...@tls.msk.ru>
> Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>
> ---
>  qemu-img.c | 63 ++++++++++++++++--------------------------------------
>  1 file changed, 18 insertions(+), 45 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 7ed5e6d1a8..08536553c7 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -158,6 +158,17 @@ void cmd_help(const img_cmd_t *ccmd,
>      exit(EXIT_SUCCESS);
>  }
>  
> +static OutputFormat parse_output_format(const char *argv0, const char *arg)
> +{
> +    if (!strcmp(arg, "json")) {
> +        return OFORMAT_JSON;
> +    } else if (!strcmp(arg, "human")) {
> +        return OFORMAT_HUMAN;
> +    } else {
> +        error_exit(argv0, "--output expects 'human' or 'json' not '%s'", 
> arg);

I would expect a comma before "not '%s'".

With this changed:
Reviewed-by: Kevin Wolf <kw...@redhat.com>


Reply via email to