[Spice-devel] [PATCH 3/5] client: add --version cmdline option to spicec

Christophe Fergeau cfergeau at redhat.com
Mon Apr 18 04:01:10 PDT 2011


This fixes freedesktop bug #33907
---
 client/application.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/client/application.cpp b/client/application.cpp
index e74a871..ef08087 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2183,7 +2183,8 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
     DisplaySetting display_setting;
 
     enum {
-        SPICE_OPT_HOST = CmdLineParser::OPTION_FIRST_AVAILABLE,
+        SPICE_OPT_VERSION = CmdLineParser::OPTION_FIRST_AVAILABLE,
+        SPICE_OPT_HOST,
         SPICE_OPT_PORT,
         SPICE_OPT_SPORT,
         SPICE_OPT_PASSWORD,
@@ -2224,6 +2225,7 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
 
     CmdLineParser parser("Spice client", false);
 
+    parser.add(SPICE_OPT_VERSION, "version", "spice client version", false);
     parser.add(SPICE_OPT_HOST, "host", "spice server address", "host", true, 'h');
     parser.add(SPICE_OPT_PORT, "port", "spice server port", "port", true, 'p');
     parser.add(SPICE_OPT_SPORT, "secure-port", "spice server secure port", "port", true, 's');
@@ -2286,6 +2288,12 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
     int op;
     while ((op = parser.get_option(&val)) != CmdLineParser::OPTION_DONE) {
         switch (op) {
+        case SPICE_OPT_VERSION: {
+            std::ostringstream os;
+            os << argv[0] << " "<< PACKAGE_VERSION << std::endl;
+            Platform::term_printf(os.str().c_str());
+            return false;
+        }
         case SPICE_OPT_HOST:
             host = val;
             break;
-- 
1.7.4.4



More information about the Spice-devel mailing list