[Libguestfs] [PATCH 2/3] builder: add --list-format
Richard W.M. Jones
rjones at redhat.com
Thu Jan 16 15:44:56 UTC 2014
On Thu, Jan 16, 2014 at 03:04:31PM +0100, Pino Toscano wrote:
> Add a --list-format which allows to choose which in format should be the
> output of --list.
> ---
> builder/cmdline.ml | 11 ++++++++++-
> builder/virt-builder.pod | 24 +++++++++++++++++++++---
> 2 files changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/builder/cmdline.ml b/builder/cmdline.ml
> index f199f03..6d6439f 100644
> --- a/builder/cmdline.ml
> +++ b/builder/cmdline.ml
> @@ -132,6 +132,13 @@ let parse_cmdline () =
>
> let list_format = ref `Short in
> let list_set_long () = list_format := `Long in
> + let list_set_format arg =
> + list_format := match arg with
> + | "short" -> `Short
> + | "long" -> `Long
> + | fmt ->
> + eprintf (f_"%s: invalid --list-format type '%s', see the man page.\n") prog fmt;
> + exit 1 in
It's possible to write this as:
let list_set_format = function
| "short" -> list_format := `Short
etc.
Not sure if it will make any difference here.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list