search for: machine_readable_fn

Displaying 13 results from an estimated 13 matches for "machine_readable_fn".

2019 Mar 28
0
[PATCH v2 1/4] common/mltools: move the code for machine readable up
...: Guestfs.t -> int64 -> (string * key_store_key) list external c_set_echo_keys : unit -> unit = "guestfs_int_mllib_set_echo_keys" "noalloc" external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" +type machine_readable_fn = { + pr : 'a. ('a, unit, string, unit) format4 -> 'a; +} (* [@@unboxed] *) + +type machine_readable_output_type = + | NoOutput + | Channel of out_channel + | File of string +let machine_readable_output = ref NoOutput +let machine_readable_channel = ref None +let machine_readable...
2018 Sep 20
1
Re: [PATCH 1/2] mltools: create a cmdline_options struct
...2: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_op...
2019 Mar 22
8
[PATCH 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Pino Toscano (4): common/mltools: move the code for machine readable up common/mltools: make sure machine
2019 Apr 01
2
[PATCH] OCaml tools: fix 3999 -> 3339 typo
...guestfs_int_mllib_set_keys_from_stdin" "noalloc" -external c_rfc3999_date_time_string : unit -> string = "guestfs_int_mllib_rfc3999_date_time_string" +external c_rfc3339_date_time_string : unit -> string = "guestfs_int_mllib_rfc3339_date_time_string" type machine_readable_fn = { pr : 'a. ('a, unit, string, unit) format4 -> 'a; @@ -93,7 +93,7 @@ let log_as_json msgtype msg = | Some { pr } -> let json = [ "message", JSON.String msg; - "timestamp", JSON.String (c_rfc3999_date_time_string ()); + "timest...
2019 Mar 28
8
[PATCH v2 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Changes from v1: - use Obj.magic to convert int -> Unix.file_descr - add tests Pino Toscano (4):
2019 Mar 22
0
[PATCH 3/4] common/mltools: allow fd for machine readable output
...uestfs_int_mllib_set_echo_keys" "noalloc" external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" +external c_out_channel_from_fd : int -> out_channel = "guestfs_int_mllib_open_out_channel_from_fd" type machine_readable_fn = { pr : 'a. ('a, unit, string, unit) format4 -> 'a; @@ -41,6 +42,7 @@ type machine_readable_output_type = | NoOutput | Channel of out_channel | File of string + | Fd of int let machine_readable_output = ref NoOutput let machine_readable_channel = ref None let machine...
2018 Aug 23
0
[PATCH v2 2/2] OCaml tools: add output selection for --machine-readable
...le=stream:stderr 2>&1 >/dev/null | wc -l) -eq 2 diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 920977e42..3daed287b 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -229,10 +229,61 @@ let human_size i = ) ) +type machine_readable_fn = { + pr : 'a. ('a, unit, string, unit) format4 -> 'a; +} (* [@@unboxed] *) + +type machine_readable_output_type = + | NoOutput + | Channel of out_channel + | File of string +let machine_readable_output = ref NoOutput +let machine_readable_channel = ref None +let machine_readable...
2019 Mar 22
0
[PATCH 4/4] OCaml tools: output messages into JSON for machine readable
...;guestfs_int_mllib_set_keys_from_stdin" "noalloc" external c_out_channel_from_fd : int -> out_channel = "guestfs_int_mllib_open_out_channel_from_fd" +external c_rfc3999_date_time_string : unit -> string = "guestfs_int_mllib_rfc3999_date_time_string" type machine_readable_fn = { pr : 'a. ('a, unit, string, unit) format4 -> 'a; @@ -85,12 +86,24 @@ let ansi_magenta ?(chan = stdout) () = let ansi_restore ?(chan = stdout) () = if colours () || istty chan then output_string chan "\x1b[0m" +let log_as_json msgtype msg = + match machine_read...
2018 Sep 19
0
[PATCH 1/2] mltools: create a cmdline_options struct
...t of lines. *) let external_command ?(echo_cmd = true) cmd = 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 : Get...
2018 Aug 23
3
[PATCH v2 0/2] add output selection for --machine-readable
Hi, this adds the possibility to select the output for --machine-readable in OCaml tools. 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 possible to add additional output for
2019 Mar 28
0
[PATCH v2 4/4] OCaml tools: output messages into JSON for machine readable
...estfs_int_mllib_set_echo_keys" "noalloc" external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" +external c_rfc3999_date_time_string : unit -> string = "guestfs_int_mllib_rfc3999_date_time_string" type machine_readable_fn = { pr : 'a. ('a, unit, string, unit) format4 -> 'a; @@ -86,12 +87,24 @@ let ansi_magenta ?(chan = stdout) () = let ansi_restore ?(chan = stdout) () = if colours () || istty chan then output_string chan "\x1b[0m" +let log_as_json msgtype msg = + match machine_read...
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 +-
2018 Sep 19
0
[PATCH 2/2] Introduce a --key option in tools that accept keys
...ut ?(sleep = 2) fn = let start_t = Unix.gettimeofday () in diff --git a/common/mltools/tools_utils.mli b/common/mltools/tools_utils.mli index 99984bfa1..01c5e51bb 100644 --- a/common/mltools/tools_utils.mli +++ b/common/mltools/tools_utils.mli @@ -74,8 +74,11 @@ val machine_readable : unit -> machine_readable_fn option readable output to, in case it was enabled via [--machine-readable]. *) +type key_store + type cmdline_options = { getopt : Getopt.t; (** The actual Getopt handle. *) + ks : key_store; (** Container for keys read via [--key]. *) } (** Structure...