Add --version options to virt-df, virt-inspector and virt-v2v.
[libguestfs.git] / inspector / virt-inspector.pl
index 5f8c892..3665d37 100755 (executable)
@@ -88,6 +88,14 @@ Display brief help.
 
 =cut
 
+my $version;
+
+=item B<--version>
+
+Display version number and exit.
+
+=cut
+
 my $uri;
 
 =item B<--connect URI> | B<-c URI>
@@ -172,6 +180,7 @@ default.
 =cut
 
 GetOptions ("help|?" => \$help,
+           "version" => \$version,
            "connect|c=s" => \$uri,
            "text" => sub { $output = "text" },
            "none" => sub { $output = "none" },
@@ -186,6 +195,12 @@ GetOptions ("help|?" => \$help,
            "windows-registry" => \$windows_registry,
     ) or pod2usage (2);
 pod2usage (1) if $help;
+if ($version) {
+    my $g = Sys::Guestfs->new ();
+    my %h = $g->version ();
+    print "$h{major}.$h{minor}.$h{release}$h{extra}\n";
+    exit
+}
 pod2usage ("$0: no image or VM names given") if @ARGV == 0;
 
 my $rw = 0;