diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-09 17:17:04 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-09 17:17:04 -0500 |
| commit | 92773706b946533b07de9ade7be28e307954ae38 (patch) | |
| tree | f6adbdc250e2cbafd8d391b0aa19308976af5014 /src/commandline.cpp | |
| parent | fef8543a58b4226242ce26c4c8876abaa64394cb (diff) | |
don't attempt to parse the command line for launch, it fails in all sorts of ways
don't try to time stuff before logging is initialized, an exception before initLogging() will crash because ~TimeThis() tries to log
Diffstat (limited to 'src/commandline.cpp')
| -rw-r--r-- | src/commandline.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/commandline.cpp b/src/commandline.cpp index fd2fcb51..5e65424c 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -95,34 +95,34 @@ std::optional<int> CommandLine::run(const std::wstring& line) if (c->name() == commandName) { // this is a command - // remove the command name itself - opts.erase(opts.begin()); + // remove the command name itself + opts.erase(opts.begin()); try { - // parse the the remainder of the command line according to the - // command's options - po::wcommand_line_parser parser(opts); + // legacy commands handle their own parsing, such as 'launch'; don't + // attempt to parse anything here + if (!c->legacy()) { + // parse the the remainder of the command line according to the + // command's options + po::wcommand_line_parser parser(opts); - auto co = c->allOptions(); - parser.options(co); + auto co = c->allOptions(); + parser.options(co); - if (c->allow_unregistered()) { - parser.allow_unregistered(); - } - - auto pos = c->positional(); - parser.positional(pos); + auto pos = c->positional(); + parser.positional(pos); - parsed = parser.run(); + parsed = parser.run(); - po::store(parsed, m_vm); - po::notify(m_vm); + po::store(parsed, m_vm); + po::notify(m_vm); - if (m_vm.count("help")) { - env::Console console; - std::cout << usage(c.get()) << "\n"; - return 0; + if (m_vm.count("help")) { + env::Console console; + std::cout << usage(c.get()) << "\n"; + return 0; + } } // run the command @@ -405,11 +405,6 @@ std::string Command::usageLine() const return name() + " " + getUsageLine(); } -bool Command::allow_unregistered() const -{ - return false; -} - po::options_description Command::allOptions() const { po::options_description d; @@ -435,6 +430,11 @@ po::positional_options_description Command::positional() const return getPositional(); } +bool Command::legacy() const +{ + return true; +} + std::string Command::getUsageLine() const { return "[options]"; @@ -522,14 +522,14 @@ std::optional<int> CrashDumpCommand::doRun() } -bool LaunchCommand::allow_unregistered() const +Command::Meta LaunchCommand::meta() const { - return true; + return {"launch", "(internal, do not use)"}; } -Command::Meta LaunchCommand::meta() const +bool LaunchCommand::legacy() const { - return {"launch", "(internal, do not use)"}; + return true; } std::optional<int> LaunchCommand::doRun() |
