X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=inspector%2Fvirt-inspector.pl;h=fc9b68e36d4cf6180ea729bc6e84e8117b48facd;hp=28bee77818e221dc58f5dff2e615674bb4b7a4b7;hb=7ca3e5b08ae6e6f062b5065475ffb07cb08a7610;hpb=1154aff2c68b7ac156713c7fd66b5aa8907a3cb2 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 ();