summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-26 12:11:23 +0100
committerRichard Jones <rjones@redhat.com>2009-04-26 12:11:23 +0100
commit0b2748bb2729bea0d6f6b794e7f6e0cfb8d36bcc (patch)
treedbc2a067ec48c3a8d03caf8c12eddae2effeecdb
parentedd99a3f7903f6f80d3f73643cd6ee114dbdd553 (diff)
downloadlibguestfs-0b2748bb2729bea0d6f6b794e7f6e0cfb8d36bcc.tar.gz
libguestfs-0b2748bb2729bea0d6f6b794e7f6e0cfb8d36bcc.tar.xz
libguestfs-0b2748bb2729bea0d6f6b794e7f6e0cfb8d36bcc.zip
Add --version option (show version) to guestfish.
-rw-r--r--fish/fish.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fish/fish.c b/fish/fish.c
index c8e95065..a5fc337d 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -100,13 +100,14 @@ usage (void)
" -n|--no-sync Don't autosync\n"
" -r|--ro Mount read-only\n"
" -v|--verbose Verbose messages\n"
+ " -V|--version Display version and exit\n"
"For more information, see the manpage guestfish(1).\n");
}
int
main (int argc, char *argv[])
{
- static const char *options = "a:h::m:nrv?";
+ static const char *options = "a:h::m:nrv?V";
static struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "cmd-help", 2, 0, 'h' },
@@ -115,6 +116,7 @@ main (int argc, char *argv[])
{ "no-sync", 0, 0, 'n' },
{ "ro", 0, 0, 'r' },
{ "verbose", 0, 0, 'v' },
+ { "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
struct mp *mps = NULL;
@@ -200,6 +202,10 @@ main (int argc, char *argv[])
guestfs_set_verbose (g, verbose);
break;
+ case 'V':
+ printf ("guestfish %s\n", PACKAGE_VERSION);
+ exit (0);
+
case '?':
usage ();
exit (0);