MCPcopy Create free account
hub / github.com/audacity/audacity / ParseCommandLine

Method ParseCommandLine

src/AudacityApp.cpp:2439–2486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2437#endif
2438
2439std::unique_ptr<wxCmdLineParser> AudacityApp::ParseCommandLine()
2440{
2441 auto parser = std::make_unique<wxCmdLineParser>(argc, argv);
2442 if (!parser)
2443 {
2444 return nullptr;
2445 }
2446
2447 /*i18n-hint: This controls the number of bytes that Audacity will
2448 * use when writing files to the disk */
2449 parser->AddOption(wxT("b"), wxT("blocksize"), _("set max disk block size in bytes"),
2450 wxCMD_LINE_VAL_NUMBER);
2451
2452 const auto journalOptionDescription =
2453 /*i18n-hint: brief help message for Audacity's command-line options
2454 A journal contains a sequence of user interface interactions to be repeated
2455 "log," "trail," "trace" have somewhat similar meanings */
2456 _("replay a journal file");
2457
2458 parser->AddOption(wxT("j"), wxT("journal"), journalOptionDescription);
2459
2460 /*i18n-hint: This displays a list of available options */
2461 parser->AddSwitch(wxT("h"), wxT("help"), _("this help message"),
2462 wxCMD_LINE_OPTION_HELP);
2463
2464 /*i18n-hint: This runs a set of automatic tests on Audacity itself */
2465 parser->AddSwitch(wxT("t"), wxT("test"), _("run self diagnostics"));
2466
2467 /*i18n-hint: This displays the Audacity version */
2468 parser->AddSwitch(wxT("v"), wxT("version"), _("display Audacity version"));
2469
2470 /*i18n-hint: This is a list of one or more files that Audacity
2471 * should open upon startup */
2472 parser->AddParam(_("audio or project file name"),
2473 wxCMD_LINE_VAL_STRING,
2474 wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL);
2475
2476#ifdef HAS_CUSTOM_URL_HANDLING
2477 /* i18n-hint: This option is used to handle custom URLs in Audacity */
2478 parser->AddOption(wxT("u"), wxT("url"), _("Handle 'audacity://' url"));
2479#endif
2480
2481 // Run the parser
2482 if (parser->Parse() == 0)
2483 return parser;
2484
2485 return{};
2486}
2487
2488void AudacityApp::OnQueryEndSession(wxCloseEvent & event)
2489{

Callers

nothing calls this directly

Calls 2

AddOptionMethod · 0.45
ParseMethod · 0.45

Tested by

no test coverage detected