Pino Toscano
2015-Sep-01 14:40 UTC
[Libguestfs] [PATCH 1/3] mllib: make few command line options stuff private
Make print_version_and_exit, long_options, display_short_options, and display_long_options private, as set_standard_options now takes care of handling the job for the common command line options. --- mllib/common_utils.mli | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 79032bc..24f8f83 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -90,10 +90,6 @@ val info : ('a, unit, string, unit) format4 -> 'a val run_main_and_handle_errors : (unit -> unit) -> unit (** Common function for handling pretty-printing exceptions. *) -val print_version_and_exit : unit -> unit -(** Print the version number and exit. Implements [--version] flag in - the OCaml tools. *) - val generated_by : string (** The string "generated by <prog> <version>". *) @@ -116,12 +112,6 @@ val skip_dashes : string -> string val compare_command_line_args : string -> string -> int (** Compare command line arguments for equality, ignoring any leading [-]s. *) -val long_options : (Arg.key * Arg.spec * Arg.doc) list ref -val display_short_options : unit -> 'a -(** Implements [--short-options]. *) -val display_long_options : unit -> 'a -(** Implements [--long-options]. *) - val set_standard_options : (Arg.key * Arg.spec * Arg.doc) list -> (Arg.key * Arg.spec * Arg.doc) list (** Adds the standard libguestfs command line options to the specified ones, sorting them, and setting [long_options] to them. -- 2.1.0
Pino Toscano
2015-Sep-01 14:40 UTC
[Libguestfs] [PATCH 2/3] mllib: move -q/--quiet as common option
Most of the OCaml-based tools had it already, except from virt-dib and virt-get-kernel. --- builder/cmdline.ml | 1 - customize/customize_main.ml | 2 -- mllib/common_utils.ml | 2 ++ resize/resize.ml | 2 -- sparsify/cmdline.ml | 2 -- sysprep/main.ml | 2 -- v2v/cmdline.ml | 2 -- 7 files changed, 2 insertions(+), 11 deletions(-) diff --git a/builder/cmdline.ml b/builder/cmdline.ml index 1537208..e6753ae 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -136,7 +136,6 @@ let parse_cmdline () "--output", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename"; "--print-cache", Arg.Unit print_cache_mode, " " ^ s_"Print info about template cache"; - "--quiet", Arg.Unit set_quiet, " " ^ s_"No progress messages"; "--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size"; "--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs"; "--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL"; diff --git a/customize/customize_main.ml b/customize/customize_main.ml index 42af3c7..49d510c 100644 --- a/customize/customize_main.ml +++ b/customize/customize_main.ml @@ -88,8 +88,6 @@ let main () "--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size"; "--network", Arg.Set network, " " ^ s_"Enable appliance network (default)"; "--no-network", Arg.Clear network, " " ^ s_"Disable appliance network"; - "-q", Arg.Unit set_quiet, " " ^ s_"Don't print log messages"; - "--quiet", Arg.Unit set_quiet, " " ^ s_"Don't print log messages"; "--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs"; ] in let customize_argspec, get_customize_ops diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index 62d72b1..0c34b7d 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -525,6 +525,8 @@ let set_standard_options argspec "--verbose", Arg.Unit set_verbose, " " ^ s_"Enable libguestfs debugging messages"; "-x", Arg.Unit set_trace, " " ^ s_"Enable tracing of libguestfs calls"; "--debug-gc", Arg.Unit set_debug_gc, " " ^ s_"Debug GC and memory allocations (internal)"; + "-q", Arg.Unit set_quiet, " " ^ s_"Don't print progress messages"; + "--quiet", Arg.Unit set_quiet, " " ^ s_"Don't print progress messages"; ] @ argspec in let argspec let cmp (arg1, _, _) (arg2, _, _) = compare_command_line_args arg1 arg2 in diff --git a/resize/resize.ml b/resize/resize.ml index edd3bc7..75bb2f7 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -211,8 +211,6 @@ let main () "--dryrun", Arg.Set dryrun, ditto; "--ntfsresize-force", Arg.Set ntfsresize_force, " " ^ s_"Force ntfsresize"; "--output-format", Arg.Set_string output_format, s_"format" ^ " " ^ s_"Format of output disk"; - "-q", Arg.Unit set_quiet, " " ^ s_"Don't print the summary"; - "--quiet", Arg.Unit set_quiet, ditto; "--resize", Arg.String (add resizes), s_"part=size" ^ " " ^ s_"Resize partition"; "--resize-force", Arg.String (add resizes_force), s_"part=size" ^ " " ^ s_"Forcefully resize partition"; "--shrink", Arg.String set_shrink, s_"part" ^ " " ^ s_"Shrink partition"; diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml index 10c2767..17b5542 100644 --- a/sparsify/cmdline.ml +++ b/sparsify/cmdline.ml @@ -65,8 +65,6 @@ let parse_cmdline () "--inplace", Arg.Set in_place, ditto; "--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable"; "-o", Arg.Set_string option, s_"option" ^ " " ^ s_"Add qemu-img options"; - "-q", Arg.Unit set_quiet, " " ^ s_"Quiet output"; - "--quiet", Arg.Unit set_quiet, ditto; "--tmp", Arg.Set_string tmp, s_"block|dir|prebuilt:file" ^ " " ^ s_"Set temporary block device, directory or prebuilt file"; "--zero", Arg.String (add zeroes), s_"fs" ^ " " ^ s_"Zero filesystem"; ] in diff --git a/sysprep/main.ml b/sysprep/main.ml index a95afce..bd3eb4d 100644 --- a/sysprep/main.ml +++ b/sysprep/main.ml @@ -135,8 +135,6 @@ let main () " " ^ s_"Compatibility option, does nothing"; "--operation", Arg.String set_operations, " " ^ s_"Enable/disable specific operations"; "--operations", Arg.String set_operations, " " ^ s_"Enable/disable specific operations"; - "-q", Arg.Unit set_quiet, " " ^ s_"Don't print log messages"; - "--quiet", Arg.Unit set_quiet, " " ^ s_"Don't print log messages"; ] in let args = basic_args @ Sysprep_operation.extra_args () in let argspec = set_standard_options args in diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index ad0b16c..ce8877d 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -159,8 +159,6 @@ let parse_cmdline () "--password-file", Arg.Set_string password_file, "file " ^ s_"Use password from file"; "--print-source", Arg.Set print_source, " " ^ s_"Print source and stop"; "--qemu-boot", Arg.Set qemu_boot, " " ^ s_"Boot in qemu (-o qemu only)"; - "-q", Arg.Unit set_quiet, " " ^ s_"Quiet output"; - "--quiet", Arg.Unit set_quiet, " " ^ s_"Quiet output"; "--root", Arg.String set_root_choice,"ask|... " ^ s_"How to choose root filesystem"; "--vdsm-image-uuid", Arg.String add_vdsm_image_uuid, "uuid " ^ s_"Output image UUID(s)"; -- 2.1.0
Pino Toscano
2015-Sep-01 14:40 UTC
[Libguestfs] [PATCH 3/3] builder, dib, get-kernel: document new -q/--quiet options
Provided as common options for all the OCaml-based tools. --- builder/virt-builder.pod | 2 ++ dib/virt-dib.pod | 6 ++++++ get-kernel/virt-get-kernel.pod | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod index fc49d4d..710f006 100644 --- a/builder/virt-builder.pod +++ b/builder/virt-builder.pod @@ -451,6 +451,8 @@ directory. Print information about the template cache. See L</CACHING>. +=item B<-q> + =item B<--quiet> Don't print ordinary progress messages. diff --git a/dib/virt-dib.pod b/dib/virt-dib.pod index aafeacd..9baae23 100644 --- a/dib/virt-dib.pod +++ b/dib/virt-dib.pod @@ -290,6 +290,12 @@ to debug failures to run scripts. The default is to delete the output file if virt-dib fails (or, for example, some script that it runs fails). +=item B<-q> + +=item B<--quiet> + +Don't print ordinary progress messages. + =item B<--qemu-img-options> option[,option,...] Pass I<--qemu-img-options> option(s) to the L<qemu-img(1)> command diff --git a/get-kernel/virt-get-kernel.pod b/get-kernel/virt-get-kernel.pod index be0e8bb..a75f05e 100644 --- a/get-kernel/virt-get-kernel.pod +++ b/get-kernel/virt-get-kernel.pod @@ -99,6 +99,12 @@ C<mydistro-vmlinuz-3.19.0-20-generic> when the prefix is C<mydistro>. See also I<--unversioned-names>. +=item B<-q> + +=item B<--quiet> + +Don't print ordinary progress messages. + =item B<--unversioned-names> This option affects the destination file name of extracted files. -- 2.1.0
Richard W.M. Jones
2015-Sep-01 20:18 UTC
Re: [Libguestfs] [PATCH 3/3] builder, dib, get-kernel: document new -q/--quiet options
ACK series. 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
Seemingly Similar Threads
- [PATCH 1/2] mllib: add and use set_standard_options
- [PATCH] RFC: OCaml tools: add and use a Getopt module
- [PATCH v3 0/3] mllib: Various fixes and changes to Getopt module.
- [PATCH v4 0/2] mllib: Various fixes and changes to Getopt module.
- [PATCH v2 0/3] mllib: Various fixes and changes to Getopt module.