Pino Toscano
2018-Aug-10 12:00 UTC
[Libguestfs] [PATCH] Change wording from "twice" to "more than once" in error messages
When erroring out about duplicated parameters, say "more than once" instead of "twice", since there can be more than two repeated parameters. Thanks to: Xiaodai Wang --- generator/fish.ml | 2 +- generator/perl.ml | 2 +- resize/resize.ml | 4 ++-- tools/virt-tar | 4 ++-- v2v/input_libvirt_vddk.ml | 2 +- v2v/output_rhv_upload.ml | 4 ++-- v2v/output_vdsm.ml | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/generator/fish.ml b/generator/fish.ml index 33da789bd..708c1b3a9 100644 --- a/generator/fish.ml +++ b/generator/fish.ml @@ -367,7 +367,7 @@ let generate_fish_run_cmds actions () pr " }\n"; pr "\n"; pr " if (optargs_s.bitmask & this_mask) {\n"; - pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given twice\\n\"),\n"; + pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given more than once\\n\"),\n"; pr " cmd, this_arg);\n"; pr " goto out;\n"; pr " }\n"; diff --git a/generator/perl.ml b/generator/perl.ml index 5fa00a92d..cd0595640 100644 --- a/generator/perl.ml +++ b/generator/perl.ml @@ -496,7 +496,7 @@ PREINIT: ) optargs; pr "croak (\"unknown optional argument '%%s'\", this_arg);\n"; pr " if (optargs_s.bitmask & this_mask)\n"; - pr " croak (\"optional argument '%%s' given twice\",\n"; + pr " croak (\"optional argument '%%s' given more than once\",\n"; pr " this_arg);\n"; pr " optargs_s.bitmask |= this_mask;\n"; pr " }\n"; diff --git a/resize/resize.ml b/resize/resize.ml index 8e4bb1b16..174f1c699 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -170,7 +170,7 @@ let main () let expand = ref "" in let set_expand s if s = "" then error (f_"empty --expand option") - else if !expand <> "" then error (f_"--expand option given twice") + else if !expand <> "" then error (f_"--expand option given more than once") else expand := s in let expand_content = ref true in @@ -186,7 +186,7 @@ let main () let shrink = ref "" in let set_shrink s if s = "" then error (f_"empty --shrink option") - else if !shrink <> "" then error (f_"--shrink option given twice") + else if !shrink <> "" then error (f_"--shrink option given more than once") else shrink := s in let sparse = ref true in diff --git a/tools/virt-tar b/tools/virt-tar index 2d5c8b0b7..57e6b2602 100755 --- a/tools/virt-tar +++ b/tools/virt-tar @@ -187,14 +187,14 @@ Specify that the input or output tarball is gzip-compressed. sub set_mode_x { - die __"virt-tar: extract/upload mode specified twice on the command line\n" + die __"virt-tar: extract/upload mode specified more than once on the command line\n" if $mode; $mode = "x"; } sub set_mode_u { - die __"virt-tar: extract/upload mode specified twice on the command line\n" + die __"virt-tar: extract/upload mode specified more than once on the command line\n" if $mode; $mode = "u"; } diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml index 630a07e26..c868b997c 100644 --- a/v2v/input_libvirt_vddk.ml +++ b/v2v/input_libvirt_vddk.ml @@ -87,7 +87,7 @@ let parse_input_options options (key, value) ) options in - (* Check no option appears twice. *) + (* Check no option appears more than once. *) let keys = List.map fst options in if List.length keys <> List.length (List.sort_uniq keys) then error (f_"-it vddk: duplicate -io options on the command line"); diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 6260eaac5..2bff35029 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -53,11 +53,11 @@ let parse_output_options options function | "rhv-cafile", v -> if !rhv_cafile <> None then - error (f_"-o rhv-upload: -oo rhv-cafile set twice"); + error (f_"-o rhv-upload: -oo rhv-cafile set more than once"); rhv_cafile := Some v | "rhv-cluster", v -> if !rhv_cluster <> None then - error (f_"-o rhv-upload: -oo rhv-cluster set twice"); + error (f_"-o rhv-upload: -oo rhv-cluster set more than once"); rhv_cluster := Some v | "rhv-direct", "" -> rhv_direct := true | "rhv-direct", v -> rhv_direct := bool_of_string v diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index 95eb1eaf7..dc107cf2f 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -69,11 +69,11 @@ let parse_output_options options error (f_"-o vdsm: unknown vdsm-compat level ā%sā") v | "vdsm-vm-uuid", v -> if !vm_uuid <> None then - error (f_"-o vdsm: -oo vdsm-vm-uuid set twice"); + error (f_"-o vdsm: -oo vdsm-vm-uuid set more than once"); vm_uuid := Some v; | "vdsm-ovf-output", v -> if !ovf_output <> None then - error (f_"-o vdsm: -oo vdsm-ovf-output set twice"); + error (f_"-o vdsm: -oo vdsm-ovf-output set more than once"); ovf_output := Some v; | "vdsm-ovf-flavour", v -> ovf_flavour := Create_ovf.ovf_flavour_of_string v -- 2.17.1
Richard W.M. Jones
2018-Aug-10 12:47 UTC
Re: [Libguestfs] [PATCH] Change wording from "twice" to "more than once" in error messages
On Fri, Aug 10, 2018 at 02:00:19PM +0200, Pino Toscano wrote:> When erroring out about duplicated parameters, say "more than once" > instead of "twice", since there can be more than two repeated > parameters. > > Thanks to: Xiaodai Wang > --- > generator/fish.ml | 2 +- > generator/perl.ml | 2 +- > resize/resize.ml | 4 ++-- > tools/virt-tar | 4 ++-- > v2v/input_libvirt_vddk.ml | 2 +- > v2v/output_rhv_upload.ml | 4 ++-- > v2v/output_vdsm.ml | 4 ++-- > 7 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/generator/fish.ml b/generator/fish.ml > index 33da789bd..708c1b3a9 100644 > --- a/generator/fish.ml > +++ b/generator/fish.ml > @@ -367,7 +367,7 @@ let generate_fish_run_cmds actions () > pr " }\n"; > pr "\n"; > pr " if (optargs_s.bitmask & this_mask) {\n"; > - pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given twice\\n\"),\n"; > + pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given more than once\\n\"),\n"; > pr " cmd, this_arg);\n"; > pr " goto out;\n"; > pr " }\n"; > diff --git a/generator/perl.ml b/generator/perl.ml > index 5fa00a92d..cd0595640 100644 > --- a/generator/perl.ml > +++ b/generator/perl.ml > @@ -496,7 +496,7 @@ PREINIT: > ) optargs; > pr "croak (\"unknown optional argument '%%s'\", this_arg);\n"; > pr " if (optargs_s.bitmask & this_mask)\n"; > - pr " croak (\"optional argument '%%s' given twice\",\n"; > + pr " croak (\"optional argument '%%s' given more than once\",\n"; > pr " this_arg);\n"; > pr " optargs_s.bitmask |= this_mask;\n"; > pr " }\n"; > diff --git a/resize/resize.ml b/resize/resize.ml > index 8e4bb1b16..174f1c699 100644 > --- a/resize/resize.ml > +++ b/resize/resize.ml > @@ -170,7 +170,7 @@ let main () > let expand = ref "" in > let set_expand s > if s = "" then error (f_"empty --expand option") > - else if !expand <> "" then error (f_"--expand option given twice") > + else if !expand <> "" then error (f_"--expand option given more than once") > else expand := s > in > let expand_content = ref true in > @@ -186,7 +186,7 @@ let main () > let shrink = ref "" in > let set_shrink s > if s = "" then error (f_"empty --shrink option") > - else if !shrink <> "" then error (f_"--shrink option given twice") > + else if !shrink <> "" then error (f_"--shrink option given more than once") > else shrink := s > in > let sparse = ref true in > diff --git a/tools/virt-tar b/tools/virt-tar > index 2d5c8b0b7..57e6b2602 100755 > --- a/tools/virt-tar > +++ b/tools/virt-tar > @@ -187,14 +187,14 @@ Specify that the input or output tarball is gzip-compressed. > > sub set_mode_x > { > - die __"virt-tar: extract/upload mode specified twice on the command line\n" > + die __"virt-tar: extract/upload mode specified more than once on the command line\n" > if $mode; > $mode = "x"; > } > > sub set_mode_u > { > - die __"virt-tar: extract/upload mode specified twice on the command line\n" > + die __"virt-tar: extract/upload mode specified more than once on the command line\n" > if $mode; > $mode = "u"; > } > diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml > index 630a07e26..c868b997c 100644 > --- a/v2v/input_libvirt_vddk.ml > +++ b/v2v/input_libvirt_vddk.ml > @@ -87,7 +87,7 @@ let parse_input_options options > (key, value) > ) options in > > - (* Check no option appears twice. *) > + (* Check no option appears more than once. *) > let keys = List.map fst options in > if List.length keys <> List.length (List.sort_uniq keys) then > error (f_"-it vddk: duplicate -io options on the command line"); > diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml > index 6260eaac5..2bff35029 100644 > --- a/v2v/output_rhv_upload.ml > +++ b/v2v/output_rhv_upload.ml > @@ -53,11 +53,11 @@ let parse_output_options options > function > | "rhv-cafile", v -> > if !rhv_cafile <> None then > - error (f_"-o rhv-upload: -oo rhv-cafile set twice"); > + error (f_"-o rhv-upload: -oo rhv-cafile set more than once"); > rhv_cafile := Some v > | "rhv-cluster", v -> > if !rhv_cluster <> None then > - error (f_"-o rhv-upload: -oo rhv-cluster set twice"); > + error (f_"-o rhv-upload: -oo rhv-cluster set more than once"); > rhv_cluster := Some v > | "rhv-direct", "" -> rhv_direct := true > | "rhv-direct", v -> rhv_direct := bool_of_string v > diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml > index 95eb1eaf7..dc107cf2f 100644 > --- a/v2v/output_vdsm.ml > +++ b/v2v/output_vdsm.ml > @@ -69,11 +69,11 @@ let parse_output_options options > error (f_"-o vdsm: unknown vdsm-compat level ā%sā") v > | "vdsm-vm-uuid", v -> > if !vm_uuid <> None then > - error (f_"-o vdsm: -oo vdsm-vm-uuid set twice"); > + error (f_"-o vdsm: -oo vdsm-vm-uuid set more than once"); > vm_uuid := Some v; > | "vdsm-ovf-output", v -> > if !ovf_output <> None then > - error (f_"-o vdsm: -oo vdsm-ovf-output set twice"); > + error (f_"-o vdsm: -oo vdsm-ovf-output set more than once"); > ovf_output := Some v; > | "vdsm-ovf-flavour", v -> > ovf_flavour := Create_ovf.ovf_flavour_of_string vACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Eric Blake
2018-Aug-10 13:29 UTC
Re: [Libguestfs] [PATCH] Change wording from "twice" to "more than once" in error messages
On 08/10/2018 07:00 AM, Pino Toscano wrote:> When erroring out about duplicated parameters, say "more than once" > instead of "twice", since there can be more than two repeated > parameters. > > Thanks to: Xiaodai Wang > ---> +++ b/generator/fish.ml > @@ -367,7 +367,7 @@ let generate_fish_run_cmds actions () > pr " }\n"; > pr "\n"; > pr " if (optargs_s.bitmask & this_mask) {\n"; > - pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given twice\\n\"),\n"; > + pr " fprintf (stderr, _(\"%%s: optional argument \\\"%%s\\\" given more than once\\n\"),\n";Bikeshed wordsmithing for shorter lines: bar: optional argument "foo" repeated is a bit shorter... -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Maybe Matching Threads
- [PATCH INCOMPLETE 0/4] v2v: Add general mechanism for input and output options.
- [PATCH v7 0/6] v2v: Add -o rhv-upload output mode (RHBZ#1557273).
- [PATCH v7 4/6] v2v: Add general mechanism for input and output options (-io/-oo).
- Re: [PATCH v7 4/6] v2v: Add general mechanism for input and output options (-io/-oo).
- [PATCH] Use proper label for nbdkit sockets