From e01e25560fcbf0728fd011620c12cdd6eb98ae24 Mon Sep 17 00:00:00 2001 From: Gerald Schmidt Date: Thu, 30 Aug 2007 23:01:36 +0000 Subject: [PATCH] Added --version and --help command line flags. --- src/xmlcopyeditor.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index f7dfad8..f4ae76b 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -1066,6 +1066,8 @@ void MyFrame::handleCommandLine() while ((--m_argc > 0 && (*++m_argv)[0] == L'-') != 0) { + wxString wideVersion(ABOUT_VERSION); + std::string version = (const char *)wideVersion.mb_str(wxConvUTF8); while ((c = *++m_argv[0]) != 0) { switch (c) @@ -1076,8 +1078,18 @@ void MyFrame::handleCommandLine() case L's': styleFlag = true; break; + case L'-': + if (*++m_argv[0] == L'v') + { + std::cout << version.c_str() << std::endl; + } + else + { + std::cout << "Usage: xmlcopyeditor [-ws --version --help] [] []" << std::endl; + } + exit(0); default: - messagePane(_("Unknown command line switch (expecting 'w' or 's')"), + messagePane(_("Unknown command line switch (expecting 'w', 's', --version or --help)"), CONST_STOP); return; }