From: Matthew Booth Date: Thu, 25 Jun 2009 13:33:26 +0000 (+0100) Subject: Add yaml output for virt-inspector X-Git-Tag: 1.0.54~30 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=7ca3e5b08ae6e6f062b5065475ffb07cb08a7610;p=libguestfs.git Add yaml output for virt-inspector --- diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl index 28bee77..fc9b68e 100755 --- a/inspector/virt-inspector.pl +++ b/inspector/virt-inspector.pl @@ -29,6 +29,7 @@ use File::Temp qw/tempdir/; eval "use Sys::Virt;"; eval "use XML::XPath;"; eval "use XML::XPath::XMLParser;"; +eval "use YAML::Any;"; =encoding utf8 @@ -134,6 +135,11 @@ Produce no output at all. If you select I<--xml> then you get XML output which can be fed to other programs. +=item B<--yaml> + +If you select I<--yaml> then you get YAML output which can be fed +to other programs. + =item B<--perl> If you select I<--perl> then you get Perl structures output which @@ -183,6 +189,7 @@ GetOptions ("help|?" => \$help, "text" => sub { $output = "text" }, "none" => sub { $output = "none" }, "xml" => sub { $output = "xml" }, + "yaml" => sub { $output = "yaml" }, "perl" => sub { $output = "perl" }, "fish" => sub { $output = "fish" }, "guestfish" => sub { $output = "fish" }, @@ -930,6 +937,14 @@ elsif ($output eq "perl") { print Dumper(\%oses); } +# YAML output +elsif ($output eq "yaml") { + die "virt-inspector: no YAML support\n" + unless exists $INC{"YAML/Any.pm"}; + + print Dump(\%oses); +} + # Plain text output (the default). elsif ($output eq "text") { output_text ();