[Libguestfs] [PATCH 3/3] builder: add a JSON output for --list

Richard W.M. Jones rjones at redhat.com
Thu Jan 16 15:58:43 UTC 2014


On Thu, Jan 16, 2014 at 03:04:32PM +0100, Pino Toscano wrote:
> +  let json_optional_printf_string key value =
> +    match value with
> +    | None -> ()
> +    | Some str ->
> +      printf "    \"%s\": \"%s\",\n" key (json_string_escape str) in
> +  let json_optional_printf_int64 key value =
> +    match value with
> +    | None -> ()
> +    | Some n ->
> +      printf "    \"%s\": \"%Ld\",\n" key n in

Again you can shorten these slightly by:

  let json_optional_printf_string key = function
  | None -> ()
  | Some str -> ...

Anyway, *ACK* to this patch series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list