search for: anon_fun

Displaying 20 results from an estimated 100 matches for "anon_fun".

2018 Sep 20
1
Re: [PATCH 1/2] mltools: create a cmdline_options struct
...ools_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 > +...
2018 Sep 19
0
[PATCH 1/2] mltools: create a cmdline_options struct
...insertions(+), 15 deletions(-) diff --git a/builder/cmdline.ml b/builder/cmdline.ml index f05aecc76..bd099e218 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -191,7 +191,7 @@ read the man page virt-builder(1). ") prog in let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in - Getopt.parse opthandle; + Getopt.parse opthandle.getopt; (* Dereference options. *) let args = List.rev !args in diff --git a/builder/repository_main.ml b/builder/repository_main.ml index 554715a73..60ee96299 100644 --- a/builder/repository_main.ml ++...
2016 Jul 13
0
[PATCH v3 2/2] mllib: Getopt: support hidden options
...it a/mllib/getopt.ml b/mllib/getopt.ml index 90f4c44..550baa4 100644 --- a/mllib/getopt.ml +++ b/mllib/getopt.ml @@ -43,6 +43,8 @@ type t = { usage_msg : usage_msg; } +let hidden_option_description = "" + external getopt_parse : string array -> (c_keys * spec * doc) array -> ?anon_fun:anon_fun -> usage_msg -> unit = "guestfs_int_mllib_getopt_parse" let column_wrap = 38 @@ -56,6 +58,11 @@ let show_help h () = let prologue = sprintf (f_"%s\nOptions:\n") h.usage_msg in Buffer.add_string b prologue; + let specs = List.filter ( + fun (_, _, do...
2018 Aug 20
2
[PATCH 1/2] mlstdutils/mltools: factorize the machine-readable option
...unction [f] with [filename] diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 09f1bb544..04916b89a 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -229,7 +229,7 @@ let human_size i = ) ) -let create_standard_options argspec ?anon_fun ?(key_opts = false) usage_msg = +let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_readable = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in @@ -249,6 +249,11 @@...
2016 Sep 19
0
[PATCH 2/3] mllib: expose disk decrypt functionalities
...ib_set_echo_keys" "noalloc" +external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" + module Char = struct include Char @@ -591,7 +595,7 @@ let human_size i = ) ) -let create_standard_options argspec ?anon_fun usage_msg = +let create_standard_options argspec ?anon_fun ?(key_opts = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in @@ -604,6 +608,14 @@ let create_standard_options argspec ?anon_fun us...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in let customize_argspec = List.map (fun (spec, _, _) -> spec) customize_argspec in let argspec = argspec @ customize_argspec in - let argspec = set_standard_options argspec in let args = ref [] in let anon_fun s = push_front s args in @@ -192,7 +184,8 @@ A short summary of the options is given below. For detailed help please read the man page virt-builder(1). ") prog in - Arg.parse argspec anon_fun usage_msg; + let opthandle = create_standard_options argspec ~anon_fun usage_msg in + Get...
2018 Aug 20
0
[PATCH 2/2] OCaml tools: simplify machine-readable handling
...L"no-network" ], Getopt.Clear network, s_"Disable appliance network"; @@ -193,7 +190,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-builder(1). ") prog in - let opthandle = create_standard_options argspec ~anon_fun usage_msg in + let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in Getopt.parse opthandle; (* Dereference options. *) @@ -209,7 +206,6 @@ read the man page virt-builder(1). let format = match !format with "" -> None | s -> Some s...
2018 Sep 19
5
[PATCH 0/2] RFC: --key option for tools
Hi, the following series adds a --key option in the majority of tools: this makes it possible to pass LUKS credentials programmatically, avoid the need to manually input them, or unsafely pass them via stdin. Thanks, Pino Toscano (2): mltools: create a cmdline_options struct Introduce a --key option in tools that accept keys builder/cmdline.ml | 2 +-
2016 Jul 18
2
Re: [PATCH v2 2/3] mllib: Use L"..." and S '...' for long and short options.
....contains s '_' -> > + invalid_arg (sprintf "Getopt spec: L%S should not contain '_'" > + s) Why this limitation? > - let t = > - { > - specs = []; (* Set it later, with own options, and sorted. *) > - anon_fun = anon_fun; > - usage_msg = usage_msg; > - } in > - > - let specs = specs @ [ > - [ "--short-options" ], Unit (display_short_options t), hidden_option_description; > - [ "--long-options" ], Unit (display_long_options t), hidden_option_description...
2016 Jul 15
5
[PATCH 0/3] mllib: Various fixes and changes to Getopt module.
The second patch is obviously not complete yet - for discussion only. Rich.
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...ition"; ] in let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in let customize_argspec = @@ -192,7 +185,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-builder(1). ") prog in - Arg.parse argspec anon_fun usage_msg; + Getopt.parse argspec ~anon_fun usage_msg; (* Dereference options. *) let args = List.rev !args in diff --git a/customize/Makefile.am b/customize/Makefile.am index de3d7e0..f18e238 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -70,6 +70,7 @@ SOURCES_C = \...
2016 Jun 27
0
Re: [PATCH] RFC: OCaml tools: add and use a Getopt module
...stomize_argspec, get_customize_ops = Customize_cmdline.argspec () in > let customize_argspec = > @@ -192,7 +185,7 @@ A short summary of the options is given below. For detailed help please > read the man page virt-builder(1). > ") > prog in > - Arg.parse argspec anon_fun usage_msg; > + Getopt.parse argspec ~anon_fun usage_msg; > > (* Dereference options. *) > let args = List.rev !args in > diff --git a/customize/Makefile.am b/customize/Makefile.am > index de3d7e0..f18e238 100644 > --- a/customize/Makefile.am > +++ b/customize/Makefi...
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...ition"; ] in let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in let customize_argspec = @@ -192,7 +185,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-builder(1). ") prog in - Arg.parse argspec anon_fun usage_msg; + Getopt.parse argspec ~anon_fun usage_msg; (* Dereference options. *) let args = List.rev !args in diff --git a/customize/Makefile.am b/customize/Makefile.am index de3d7e0..f18e238 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -70,6 +70,7 @@ SOURCES_C = \...
2016 Jul 18
4
[PATCH v2 0/3] mllib: Various fixes and changes to Getopt module.
v1 -> v2: - Further fixes to Getopt int parsing. - Completed the L/S changes. - Fixed the test suite so it passes now. Also we don't need the special-case tests for 64 bit arch. Rich.
2019 Jan 16
0
[PATCH 2/5] mltools: create a new external_command_code
...+++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 3b1554c5a..e6b2b5713 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -338,7 +338,13 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read } (* Run an external command, slurp up the output as a list of lines. *) -let external_command ?(echo_cmd = true) cmd = +let rec external_command ?(echo_cmd = true) cmd = + let lines, exitcode = external_command_code ~echo_cmd cmd in + if exitcode <>...
2017 May 22
1
[PATCH] v2v: add crypto support (RHBZ#1451665)
...mdline.ml b/v2v/cmdline.ml index a1338eb..70301ab 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -236,7 +236,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-v2v(1). ") prog in - let opthandle = create_standard_options argspec ~anon_fun usage_msg in + let opthandle = create_standard_options argspec ~anon_fun ~key_opts:true usage_msg in Getopt.parse opthandle; (* Dereference the arguments. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 8cf1fad..59f5ef1 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -86,6 +86,9 @@ let rec main...
2018 Aug 21
0
[PATCH 2/2] OCaml tools: add output selection for --machine-readable
...in + match !machine_readable_channel with + | Some chan -> chan + | None -> + let chan = open_machine_readable_channel () in + machine_readable_channel := Some chan; + chan + in + fprintf (get_machine_readable_channel ()) fs + let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_readable = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in + let parse_machine_readable = function + | None -> + machine_readable_output := Channel...
2016 Jul 18
0
[PATCH v2 2/3] mllib: Use L"..." and S '...' for long and short options.
...bug" ], Getopt.Int ("level", set_debug), s_"Set debug level"; + [ S 'B' ], Getopt.Set_string ("path", basepath), s_"Base path of diskimage-builder library"; ] in let opthandle = create_standard_options argspec ~anon_fun:append_element usage_msg in diff --git a/generator/customize.ml b/generator/customize.ml index 0924732..259cd26 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -590,6 +590,7 @@ open Printf open Common_utils open Common_gettext.Gettext +open Getopt.OptionName open Customiz...
2018 Aug 21
4
[PATCH 0/2] RFC: add output selection for --machine-readable
Hi, this is a first approach (hence RFC, since it misses tests & documentation) in selecting the output for --machine-readable. The possible choices are: * --machine-readable: to stdout, like before * --machine-readable=file:name-of-file: to the specified file * --machine-readable=stream:stdout: explicitly to stdout * --machine-readable=stream:stderr: explicitly to stderr This makes it
2019 Jan 16
2
Re: [PATCH 2/5] mltools: create a new external_command_code
...nsertions(+), 12 deletions(-) > > diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml > index 3b1554c5a..e6b2b5713 100644 > --- a/common/mltools/tools_utils.ml > +++ b/common/mltools/tools_utils.ml > @@ -338,7 +338,13 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read > } > > (* Run an external command, slurp up the output as a list of lines. *) > -let external_command ?(echo_cmd = true) cmd = > +let rec external_command ?(echo_cmd = true) cmd = > + let lines, exitcode = external_command_code ~echo_cmd...