[Libguestfs] [PATCH 1/2] mltools: create a cmdline_options struct

Richard W.M. Jones rjones at redhat.com
Thu Sep 20 10:07:46 UTC 2018


On Wed, Sep 19, 2018 at 12:37:00PM +0200, Pino Toscano wrote:
> diff --git a/common/mltools/tools_utils.mli b/common/mltools/tools_utils.mli
> index 2b8c2b78a..99984bfa1 100644
> --- a/common/mltools/tools_utils.mli
> +++ b/common/mltools/tools_utils.mli
> @@ -74,7 +74,13 @@ val machine_readable : unit -> machine_readable_fn option
>      readable output to, in case it was enabled via
>      [--machine-readable]. *)
>  
> -val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?key_opts:bool -> ?machine_readable:bool -> Getopt.usage_msg -> Getopt.t
> +type cmdline_options = {
> +  getopt : Getopt.t;              (** The actual Getopt handle. *)
> +}
> +(** Structure representing all the data needed for handling command
> +    line options. *)
> +
> +val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?key_opts:bool -> ?machine_readable:bool -> Getopt.usage_msg -> cmdline_options
>  (** Adds the standard libguestfs command line options to the specified ones,
>      sorting them, and setting [long_options] to them.
>  
> @@ -84,7 +90,7 @@ val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?k
>      [machine_readable] specifies whether add the [--machine-readable]
>      option.
>  
> -    Returns a new [Getopt.t] handle. *)
> +    Returns a new [cmdline_options] structure. *)

There's actually a bug in the old documentation here which should be
fixed at the same time.  It should use {!...} to link the reference,
ie:

    Returns a new {!cmdline_options} structure. *)

This patch is straightforward refactoring, so ACK.

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




More information about the Libguestfs mailing list