bool MainApp::OnCmdLineParsed(wxCmdLineParser& parser) { mStartHidden = false; mBatchMode = parser.Found(wxT("b")); mEnableAppProfiles = parser.Found(wxT("a")); if (mBatchMode || mEnableAppProfiles) { mStartHidden = true; } if (!parser.Found(wxT("c"), &mColorTemp)) { mColorTemp = 0; } else { mStartHidden = true; } if (!parser.Found(wxT("i"), &mGPUIndex)) { mGPUIndex = 0; } if (parser.GetParamCount() > 0) { mProfileName = parser.GetParam(0); mStartHidden = true; } return true; }
bool EViacamApp::OnCmdLineParsed(wxCmdLineParser& parser) { bool debug_mode= parser.Found(wxT("d")); #ifndef NDEBUG debug_mode = true; #endif if (debug_mode) { // Set log priority level slog_set_priority (SLOG_PRIO_DEBUG); #if defined(WIN32) AllocConsole(); freopen("CONOUT$", "wb", stdout); freopen("CONOUT$", "wb", stderr); slog_write (SLOG_PRIO_INFO, "debug mode enabled"); #endif } wxString custom_config_path; bool custom_config= parser.Found(wxT("c"), &custom_config_path); if (custom_config) { wxFileConfig* customFileConfig = new wxFileConfig(wxEmptyString, wxEmptyString, custom_config_path, custom_config_path, wxCONFIG_USE_LOCAL_FILE); wxConfigBase::Set(customFileConfig); } return true; }
bool CFileView::OnCmdLineParsed(wxCmdLineParser& parser) { if (parser.Found(wxT("version"))) { cout << wxString::Format(wxT("MuleFileView version %u.%u.%u\nCopyright (c) 2008 aMule Team\n"), VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO); return false; } else { wxString strDecode; if (parser.Found(wxT("strings"), &strDecode)) { if (strDecode == wxT("display")) { SetStringsMode(SD_DISPLAY); } else if (strDecode == wxT("safe")) { SetStringsMode(SD_SAFE); } else if (strDecode == wxT("utf8")) { SetStringsMode(SD_UTF8); } else if (strDecode == wxT("none")) { SetStringsMode(SD_NONE); } else { parser.SetLogo(wxT("Error: Invalid argument to --strings option: \"") + strDecode + wxT("\"")); parser.Usage(); return false; } } else { SetStringsMode(SD_DISPLAY); } for (size_t n = 0; n < parser.GetParamCount(); n++) { m_files.push_back(parser.GetParam(n)); } if (m_files.size() == 0) { parser.Usage(); return false; } else { return true; } } }
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser) { int numModeOptions = 0; #if wxUSE_MDI_ARCHITECTURE if ( parser.Found(CmdLineOption::MDI) ) { m_mode = Mode_MDI; numModeOptions++; } #endif // wxUSE_MDI_ARCHITECTURE if ( parser.Found(CmdLineOption::SDI) ) { m_mode = Mode_SDI; numModeOptions++; } if ( parser.Found(CmdLineOption::SINGLE) ) { m_mode = Mode_Single; numModeOptions++; } if ( numModeOptions > 1 ) { wxLogError("Only a single option choosing the mode can be given."); return false; } return wxApp::OnCmdLineParsed(parser); }
bool CGMSKRepeaterApp::OnCmdLineParsed(wxCmdLineParser& parser) { if (!wxApp::OnCmdLineParsed(parser)) return false; m_nolog = parser.Found(NOLOGGING_SWITCH); m_gui = parser.Found(GUI_SWITCH); wxString logDir; bool found = parser.Found(LOGDIR_OPTION, &logDir); if (found) m_logDir = logDir; wxString confDir; found = parser.Found(CONFDIR_OPTION, &confDir); if (found) m_confDir = confDir; wxString audioDir; found = parser.Found(AUDIODIR_OPTION, &audioDir); if (found) m_audioDir = audioDir; else m_audioDir = ::wxGetHomeDir(); if (parser.GetParamCount() > 0U) m_name = parser.GetParam(0U); return true; }
bool SpinEditorApp::OnCmdLineParsed(wxCmdLineParser& parser) { spin::spinApp &spin = spin::spinApp::Instance(); if (parser.Found(wxT("v"))) { std::cout << "SPIN Framework: version " << VERSION << std::endl; return false; } wxString sceneID; if (parser.Found(wxT("s"), &sceneID)) spin.setSceneID(sceneID.ToStdString()); wxString userID; if (parser.Found(wxT("u"), &userID)) spin.setUserID(userID.ToStdString()); wxString serverAddr; if (parser.Found(wxT("r"), &serverAddr)) { spinListener.lo_txAddrs_.clear(); spinListener.lo_txAddrs_.push_back(lo_address_new_from_url(serverAddr.c_str())); } return true; }
bool MultiMC::OnCmdLineParsed(wxCmdLineParser& parser) { wxString parsedOption; if(parser.Found("d", &parsedOption)) { if (!wxDirExists(parsedOption)) { std::cerr << "Provided directory doesn't exist!" << std::endl; return false; } providedDir.AssignDir( parsedOption ); if(!providedDir.IsDirReadable() || !providedDir.IsDirWritable()) { std::cerr << "You don't have read or write rights for the provided directory!" << std::endl; return false; } useProvidedDir = true; } if (parser.Found("u", &parsedOption)) { updateQuiet = parser.Found("U"); thisFileName = wxStandardPaths::Get().GetExecutablePath(); updateTarget = parsedOption; startMode = START_INSTALL_UPDATE; return true; } else if(parser.Found("l", &parsedOption)) { launchInstance = parsedOption; startMode = START_LAUNCH_INSTANCE; return true; } return true; }
// Handle command line options // bool TestApp::OnCmdLineParsed(wxCmdLineParser& parser) { if (parser.GetParamCount()) { for (size_t i = 0; i < parser.GetParamCount(); i++) m_registries.push_back(parser.GetParam(i)); } m_longlist = parser.Found("longlist"); m_list = m_longlist || parser.Found("list"); m_timing = parser.Found("timing"); m_detail = !m_timing && parser.Found("detail"); wxString loc; if ( parser.Found("locale", &loc) ) { const wxLanguageInfo * const info = wxLocale::FindLanguageInfo(loc); if ( !info ) { cerr << "Locale \"" << string(loc.mb_str()) << "\" is unknown.\n"; return false; } m_locale = new wxLocale(info->Language); if ( !m_locale->IsOk() ) { cerr << "Using locale \"" << string(loc.mb_str()) << "\" failed.\n"; return false; } } return TestAppBase::OnCmdLineParsed(parser); }
bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser ) { if( parser.Found(L"console") ) { Startup.ForceConsole = true; OpenProgramLog(); } // Suppress wxWidgets automatic options parsing since none of them pertain to PCSX2 needs. //wxApp::OnCmdLineParsed( parser ); m_UseGUI = !parser.Found(L"nogui"); if( !ParseOverrides(parser) ) return false; // --- Parse Startup/Autoboot options --- Startup.NoFastBoot = parser.Found(L"fullboot"); Startup.ForceWizard = parser.Found(L"forcewiz"); Startup.PortableMode = parser.Found(L"portable"); if( parser.GetParamCount() >= 1 ) { Startup.IsoFile = parser.GetParam( 0 ); Startup.SysAutoRun = true; } if( parser.Found(L"usecd") ) { Startup.CdvdSource = CDVDsrc_Plugin; Startup.SysAutoRun = true; } return true; }
bool MacUninstallApp::OnCmdLineParsed(wxCmdLineParser& parser) { m_bBatchMode = parser.Found(wxT("batch")); m_bTestMode = parser.Found(wxT("test")); if (m_bTestMode) m_bBatchMode = true; return true; }
bool AnsiConvApp::OnCmdLineParsed(wxCmdLineParser &parser) { parser.Found("i", &input_name); parser.Found("o", &output_name); parser.Found("e", &encoding); return wxAppConsole::OnCmdLineParsed(parser); }
bool VisualCreatePatch::OnCmdLineParsed(wxCmdLineParser& parser) { if (!parser.Found(wxT("o"), &m_oldDirectory)) return false; if (!parser.Found(wxT("n"), &m_newDirectory)) return false; if (!parser.Found(wxT("p"), &m_outputFilename)) return false; return true; }
bool EkstrApp::OnCmdLineParsed(wxCmdLineParser &parser) { if (!parser.Found(_T("geometry"), &geometry)) { geometry = wxString(); } if (!parser.Found(_T("base"), &base)) { base = wxString(); } return true; }
/** * Checks the compatibility of the create option with other options or switchs. * * @param parser Command line parser. * @return <CODE>true</CODE> if the create option is compatible with other * options or switchs, <CODE>false</CODE> otherwise. */ bool CmdLineOptions::checkCreateOption(const wxCmdLineParser& parser) { wxString param; if (parser.Found(wxT("c"), ¶m)) { param = param.Strip(wxString::both); // Remove the path separators at the end of the file name wxString seps = wxFileName::GetPathSeparators(); while (!param.empty() && seps.Find(param.Last()) != -1) param.RemoveLast(); wxFileName fn(param); // Checks for incompatible switchs or options. if (parser.Found(wxT("v"))) { msgOut->Printf(_("The create option and the verify switch are incompatibles.")); return false; } if (parser.Found(wxT("a"))) { msgOut->Printf(_("The create and append options are incompatibles.")); return false; } // Checks if the file name to create is empty. if (param.empty()) { msgOut->Printf(_("The name of the checksums' file to create is empty.")); return false; } // Make the file name to create absolute if needed. if (!fn.IsAbsolute()) fn.MakeAbsolute(wxFileName::GetCwd()); // checks if the directory of the file to create exists if (!wxFileName::DirExists(fn.GetPath(wxPATH_GET_VOLUME))) { msgOut->Printf(_("The directory %s doesn't exist."), fn.GetPath(wxPATH_GET_VOLUME).c_str()); return false; } // Make the names of the files to add absolute. makeFilesListAbsolute(::wxGetCwd()); checksumsFileName = fn.GetFullPath(); // Set the action to do. action = aCreate; } return true; }
//! @brief parses the command line and sets global app options like log verbosity or log target bool UpdaterApp::OnCmdLineParsed(wxCmdLineParser& parser) { #if wxUSE_CMDLINE_PARSER if ( parser.Found(_T("help")) ) return false; // not a syntax error, but program should stop if user asked for command line usage if ( parser.Found(_T("target-exe"), &m_exe_to_update ) && parser.Found(_T("target-rev"), &m_version) ) return true; #endif return true; }
bool PhdApp::OnCmdLineParsed(wxCmdLineParser & parser) { bool bReturn = true; (void)parser.Found("i", &m_instanceNumber); m_resetConfig = parser.Found("R"); return bReturn; }
bool UsbPicProg::OnCmdLineParsed(wxCmdLineParser& parser) { wxString tmp; if (!parser.Found(("h")) && !parser.Found(("V")) && !parser.Found(("p"), &tmp) && !parser.Found(("s")) && !parser.Found(("w")) && !parser.Found(("r")) && !parser.Found(("v")) && !parser.Found(("e")) && !parser.Found(("b")) && !parser.Found(("f"), &tmp)&& !parser.Found(("d"))&& !parser.Found(("RO"), &tmp)&& !parser.Found(("RB"), &tmp)&& !parser.Found(("RT"))&& !parser.Found(("ST"))) { // no command line arguments (except maybe the filename with option "-f") // were given: open the main window m_console = false; } else // start a command line app { m_console = true; // NOTE: the console app is started from here and not from OnInit() // (which would be a more natural place!) because here we have // a reference to the wxCmdLineParser instance: CmdLineMain(parser); } return true; }
bool DolphinApp::OnCmdLineParsed(wxCmdLineParser& parser) { if (argc == 2 && File::Exists(argv[1].ToUTF8().data())) { m_load_file = true; m_file_to_load = argv[1]; } else if (parser.Parse() != 0) { return false; } if (!m_load_file) m_load_file = parser.Found("exec", &m_file_to_load); m_use_debugger = parser.Found("debugger"); m_use_logger = parser.Found("logger"); m_batch_mode = parser.Found("batch"); m_confirm_stop = parser.Found("confirm", &m_confirm_setting); m_select_video_backend = parser.Found("video_backend", &m_video_backend_name); m_select_audio_emulation = parser.Found("audio_emulation", &m_audio_emulation_name); m_play_movie = parser.Found("movie", &m_movie_file); parser.Found("user", &m_user_path); return true; }
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser) { if (parser.Found("sb")) g_doubleBuffer = GL_FALSE; else if (parser.Found("db")) g_doubleBuffer = GL_TRUE; if (parser.Found("va")) g_use_vertex_arrays = GL_TRUE; return wxApp::OnCmdLineParsed(parser); }
bool TestApp::OnCmdLineParsed(wxCmdLineParser &parser) { if (parser.Found(_T("v"))) wxLog::SetVerbose(); long debug; if (parser.Found(_T("debug"), &debug)) sz_loginit((int) debug, "draw3", SZ_LIBLOG_FACILITY_APP); else sz_loginit(2, "draw3", SZ_LIBLOG_FACILITY_APP); return true; }
/** * Checks the compatibility of the verify switch with other options or switchs. * * param parser Command line parser. * @return <CODE>true</CODE> if the verify switch is compatible with other * options or switchs, <CODE>false</CODE> otherwise. */ bool CmdLineOptions::checkVerifySwitch(const wxCmdLineParser& parser) { if (parser.Found(wxT("v"))) { // Checks for incompatible switchs or options. if (parser.Found(wxT("c"))) { msgOut->Printf(_("The verify switch and the create option are incompatibles.")); return false; } if (parser.Found(wxT("a"))) { msgOut->Printf(_("The verify switch and the append option are incompatibles.")); return false; } // Checks the number of given file if (files.IsEmpty()) { msgOut->Printf(_("The verify switch needs that you specify one file to check.")); return false; } if (files.GetCount() > 1) { msgOut->Printf(_("The verify switch needs that you specify only one file to check.")); return false; } // Checks the name of the file to open files[0] = files[0].Strip(wxString::both); if (files[0].empty()) { msgOut->Printf(_("The name of the file to check is empty.")); return false; } // Make the file name to open absolute if needed. wxFileName fn(files[0]); if (!fn.IsAbsolute()) { fn.MakeAbsolute(wxFileName::GetCwd()); files[0] = fn.GetFullPath(); } // Set the action to do. action = aVerify; } return true; }
bool CapriceApp::OnCmdLineParsed(wxCmdLineParser& parser) { intensity = -1 ; greenscreen = false ; remanency = false ; cli = false; fullscreen = parser.Found(wxT("f")); greenscreen = parser.Found(wxT("g")); remanency = parser.Found(wxT("r")); parser.Found(wxT("i"), &intensity); parser.Found(wxT("a"), &drivea); parser.Found(wxT("b"), &driveb); parser.Found(wxT("t"), &tape); parser.Found(wxT("s"), &snapshot); #if CLI if (parser.Found(wxT("c"))) { cli = true ; pthread_t threadcli; if (pthread_create (&threadcli, NULL, cliRout, NULL) < 0) { std::cout << "Fail to create cli thread." << endl ; return false ; } } #endif return true; }
bool iCPApp::OnCmdLineParsed(wxCmdLineParser &parser) { // we don't call the parents method of OnCmdLineParse, this will pull in other options we don't want if(!parser.Found(wxT("s"),&m_setting)) { m_setting=-1; }; if(!parser.Found(wxT("m"),&m_matches)) { m_matches=-1; }; parser.Found(wxT("o"),&m_output); m_input=parser.GetParam(); return true; };
bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser ) { wxString dest; if (parser.Found( L"cfgpath", &dest ) && !dest.IsEmpty()) { Console.Warning( L"Config path override: " + dest ); Overrides.SettingsFolder = dest; } if (parser.Found( L"cfg", &dest ) && !dest.IsEmpty()) { Console.Warning( L"Config file override: " + dest ); Overrides.VmSettingsFile = dest; } Overrides.DisableSpeedhacks = parser.Found(L"nohacks"); Overrides.ProfilingMode = parser.Found(L"profiling"); if (parser.Found(L"gamefixes", &dest)) { Overrides.ApplyCustomGamefixes = true; Overrides.Gamefixes.Set( dest, true ); } if (parser.Found(L"fullscreen")) Overrides.GsWindowMode = GsWinMode_Fullscreen; if (parser.Found(L"windowed")) Overrides.GsWindowMode = GsWinMode_Windowed; const PluginInfo* pi = tbl_PluginInfo; do { if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue; if( wxFileExists( dest ) ) Console.Warning( pi->GetShortname() + L" override: " + dest ); else { wxDialogWithHelpers okcan( NULL, AddAppName(_("Plugin Override Error - %s")) ); okcan += okcan.Heading( wxsFormat( _("%s Plugin Override Error! The following file does not exist or is not a valid %s plugin:\n\n"), pi->GetShortname().c_str(), pi->GetShortname().c_str() ) ); okcan += okcan.GetCharHeight(); okcan += okcan.Text(dest); okcan += okcan.GetCharHeight(); okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s."))); if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) return false; } Overrides.Filenames.Plugins[pi->id] = dest; } while( ++pi, pi->shortname != NULL ); return true; }
virtual bool OnCmdLineParsed(wxCmdLineParser& parser) { if ( parser.Found("m", &opts.mapMode) && (opts.mapMode < 1 || opts.mapMode > wxMM_METRIC) ) return false; if ( parser.Found("p", &opts.penWidth) && opts.penWidth < 1 ) return false; if ( parser.Found("w", &opts.width) && opts.width < 1 ) return false; if ( parser.Found("h", &opts.height) && opts.height < 1 ) return false; if ( parser.Found("L", &opts.numLines) && opts.numLines < 1 ) return false; return true; }
bool MainApp::OnCmdLineParsed(wxCmdLineParser& parser) { for (unsigned int i = 0; i < parser.GetParamCount(); ++i) { wxFileName fileName = parser.GetParam(i); // File names sometimes come in in the short form from Windows, so convert // to the long form. if (fileName.GetExt().Lower() == "deproj") { // This is a project file, so save the name separately. wxFileName fileName = parser.GetParam(i); m_loadProjectName = fileName.GetLongPath(); } else { wxFileName fileName = parser.GetParam(i); m_loadFileNames.Add(fileName.GetLongPath()); } } #ifndef DEDICATED_PRODUCT_VERSION parser.Found("debugexe", &m_debugExe); #endif return true; }
void XmlResApp::ParseParams(const wxCmdLineParser& cmdline) { flagGettext = cmdline.Found("g"); flagVerbose = cmdline.Found("v"); flagCPP = cmdline.Found("c"); flagPython = cmdline.Found("p"); flagH = flagCPP && cmdline.Found("e"); flagValidateOnly = cmdline.Found("validate-only"); flagValidate = flagValidateOnly || cmdline.Found("validate"); cmdline.Found("xrc-schema", &parSchemaFile); if (!cmdline.Found("o", &parOutput)) { if (flagGettext) parOutput = wxEmptyString; else { if (flagCPP) parOutput = wxT("resource.cpp"); else if (flagPython) parOutput = wxT("resource.py"); else parOutput = wxT("resource.xrs"); } } if (!parOutput.empty()) { wxFileName fn(parOutput); fn.Normalize(); parOutput = fn.GetFullPath(); parOutputPath = wxPathOnly(parOutput); } if (!parOutputPath) parOutputPath = wxT("."); if (!cmdline.Found("n", &parFuncname)) parFuncname = wxT("InitXmlResource"); for (size_t i = 0; i < cmdline.GetParamCount(); i++) { #ifdef __WINDOWS__ wxString fn=wxFindFirstFile(cmdline.GetParam(i), wxFILE); while (!fn.empty()) { parFiles.Add(fn); fn=wxFindNextFile(); } #else parFiles.Add(cmdline.GetParam(i)); #endif } }
bool CTimerControlApp::OnCmdLineParsed(wxCmdLineParser& parser) { if (!wxApp::OnCmdLineParsed(parser)) return false; m_nolog = parser.Found(NOLOGGING_SWITCH); wxString logDir; bool found = parser.Found(LOGDIR_OPTION, &logDir); if (found) m_logDir = logDir; if (parser.GetParamCount() > 0U) m_name = parser.GetParam(0U); return true; }
static void ShowCmdLine( const wxCmdLineParser& parser ) { wxString s = wxT("Input files: "); size_t count = parser.GetParamCount(); for ( size_t param = 0; param < count; param++ ) { s << parser.GetParam( param ) << ' '; } s << '\n' << wxT("Verbose:\t") << ( parser.Found(wxT("v")) ? wxT("yes") : wxT("no") ) << '\n' << wxT("Quiet:\t") << ( parser.Found(wxT("q")) ? wxT("yes") : wxT("no") ) << '\n'; wxString strVal; long lVal; wxDateTime dt; if ( parser.Found( wxT("o"), &strVal ) ) s << wxT("Output file:\t") << strVal << '\n'; if ( parser.Found( wxT("i"), &strVal ) ) s << wxT("Input dir:\t") << strVal << '\n'; if ( parser.Found( wxT("s"), &lVal ) ) s << wxT("Size:\t") << lVal << '\n'; if ( parser.Found( wxT("d"), &dt ) ) s << wxT("Date:\t") << dt.FormatISODate() << '\n'; if ( parser.Found( wxT("project_name"), &strVal ) ) s << wxT("Project:\t") << strVal << '\n'; wxLogMessage( s ); }
bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) { wxString *confName = new wxString; if (parser.Found("c",confName)) { if (confName) { config.setConfigName(confName->ToStdString()); } } config.load(); #ifdef BUNDLE_SOAPY_MODS if (parser.Found("b")) { useLocalMod.store(false); } else { useLocalMod.store(true); } #else useLocalMod.store(true); #endif wxString *modPath = new wxString; if (parser.Found("m",modPath)) { if (modPath) { modulePath = modPath->ToStdString(); } else { modulePath = ""; } } return true; }