Added --version and --help command line flags.

This commit is contained in:
Gerald Schmidt 2007-08-30 23:01:36 +00:00
parent 1f5f3b542b
commit e01e25560f
1 changed files with 13 additions and 1 deletions

View File

@ -1066,6 +1066,8 @@ void MyFrame::handleCommandLine()
while ((--m_argc > 0 && (*++m_argv)[0] == L'-') != 0) 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) while ((c = *++m_argv[0]) != 0)
{ {
switch (c) switch (c)
@ -1076,8 +1078,18 @@ void MyFrame::handleCommandLine()
case L's': case L's':
styleFlag = true; styleFlag = true;
break; break;
case L'-':
if (*++m_argv[0] == L'v')
{
std::cout << version.c_str() << std::endl;
}
else
{
std::cout << "Usage: xmlcopyeditor [-ws --version --help] [<file>] [<file2>]" << std::endl;
}
exit(0);
default: default:
messagePane(_("Unknown command line switch (expecting 'w' or 's')"), messagePane(_("Unknown command line switch (expecting 'w', 's', --version or --help)"),
CONST_STOP); CONST_STOP);
return; return;
} }