| 46 | }; |
| 47 | |
| 48 | static CommandLine |
| 49 | ParseCommandLine(int argc, char **argv) |
| 50 | { |
| 51 | CommandLine c; |
| 52 | |
| 53 | OptionParser option_parser(option_defs, argc, argv); |
| 54 | while (auto o = option_parser.Next()) { |
| 55 | switch (Option(o.index)) { |
| 56 | case OPTION_CONFIG: |
| 57 | c.config_path = o.value; |
| 58 | break; |
| 59 | |
| 60 | case OPTION_VERBOSE: |
| 61 | c.verbose = true; |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | auto args = option_parser.GetRemaining(); |
| 67 | if (args.size() != 2) |
| 68 | throw std::runtime_error("Usage: RunChromaprint [--verbose] [--config=FILE] DECODER URI"); |
| 69 | |
| 70 | c.decoder = args[0]; |
| 71 | c.uri = args[1]; |
| 72 | return c; |
| 73 | } |
| 74 | |
| 75 | class GlobalInit { |
| 76 | const ConfigData config; |