[Libguestfs] [PATCH v2 2/2] OCaml tools: add output selection for --machine-readable

Richard W.M. Jones rjones at redhat.com
Thu Aug 23 15:52:42 UTC 2018


On Thu, Aug 23, 2018 at 05:13:35PM +0200, Pino Toscano wrote:
> +=over 4
> +
> +=item file:F<filename>

Can you bold the literal strings, so:

 =item B<file:>F<filename>
 ...
 =item B<stream:stdout>
 ...
 =item B<stream:stderr>

> @@ -353,7 +355,10 @@ read the man page virt-resize(1).
>      (* The output disk is being created, so use cache=unsafe here. *)
>      add_drive_uri g ?format:output_format ~readonly:false ~cachemode:"unsafe"
>        (snd outfile);
> -    if not (quiet ()) then Progress.set_up_progress_bar ~machine_readable:(machine_readable ()) g;
> +    if not (quiet ()) then (
> +      let machine_readable = machine_readable () <> None in
> +      Progress.set_up_progress_bar ~machine_readable g

This is kind of interesting: Would the progress bar actually want to
write to the machine readable channel?

Anyway ACK, with the small changes to the man page above.

I have some ideas how we could enhance this in future.  For example we
could add extra fields to the { pr } struct for the channel, alternate
functions for writing (eg. write facts), etc.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list