Chromium Code Reviews| Index: mojo/shell/desktop/mojo_main.cc |
| diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc |
| index d929c51c495804073c8d2b51bf8e7e5a0fdcb9d6..caa84e0c6aaf4bb926579d1ce54db573b9c69c82 100644 |
| --- a/mojo/shell/desktop/mojo_main.cc |
| +++ b/mojo/shell/desktop/mojo_main.cc |
| @@ -105,9 +105,21 @@ int main(int argc, char** argv) { |
| const base::CommandLine& command_line = |
| *base::CommandLine::ForCurrentProcess(); |
| - if (!command_line.HasSwitch(switches::kEnableExternalApplications) && |
| - (command_line.HasSwitch(switches::kHelp) || |
| - command_line.GetArgs().empty())) { |
| + |
| + const std::set<std::string> all_switches = switches::GetAllSwitches(); |
| + const base::CommandLine::SwitchMap switches = command_line.GetSwitches(); |
| + bool found_unknown_switch = false; |
| + for (const auto& s : switches) { |
| + if (all_switches.find(s.first) == all_switches.end()) { |
| + std::cerr << "unknown switch: " << s.first << std::endl; |
|
hansmuller
2014/11/17 15:33:19
It might be helpful if you included argv[0] in the
|
| + found_unknown_switch = true; |
| + } |
| + } |
| + |
| + if (found_unknown_switch || |
| + (!command_line.HasSwitch(switches::kEnableExternalApplications) && |
| + (command_line.HasSwitch(switches::kHelp) || |
| + command_line.GetArgs().empty()))) { |
| Usage(); |
| return 0; |
| } |