summaryrefslogtreecommitdiffstats
path: root/inspector
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2009-06-25 14:33:26 +0100
committerMatthew Booth <mbooth@redhat.com>2009-06-25 14:33:26 +0100
commit7ca3e5b08ae6e6f062b5065475ffb07cb08a7610 (patch)
tree8f7971e22955d3d2a6fd177759e2bfda92f7892a /inspector
parent1154aff2c68b7ac156713c7fd66b5aa8907a3cb2 (diff)
downloadlibguestfs-7ca3e5b08ae6e6f062b5065475ffb07cb08a7610.tar.gz
libguestfs-7ca3e5b08ae6e6f062b5065475ffb07cb08a7610.tar.xz
libguestfs-7ca3e5b08ae6e6f062b5065475ffb07cb08a7610.zip
Add yaml output for virt-inspector
Diffstat (limited to 'inspector')
-rwxr-xr-xinspector/virt-inspector.pl15
1 files changed, 15 insertions, 0 deletions
diff --git a/inspector/virt-inspector.pl b/inspector/virt-inspector.pl
index 28bee778..fc9b68e3 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 ();