| 50 | } |
| 51 | |
| 52 | Command parseCommand(int argc, char* argv[]) |
| 53 | { |
| 54 | if (argc < 2) { |
| 55 | return Command::None; |
| 56 | } |
| 57 | |
| 58 | const char* arg1 = argv[1]; |
| 59 | |
| 60 | // Check for commands |
| 61 | if (std::strcmp(arg1, "export-pdf") == 0) { |
| 62 | return Command::ExportPdf; |
| 63 | } |
| 64 | if (std::strcmp(arg1, "export-snbx") == 0) { |
| 65 | return Command::ExportSnbx; |
| 66 | } |
| 67 | if (std::strcmp(arg1, "import") == 0) { |
| 68 | return Command::Import; |
| 69 | } |
| 70 | |
| 71 | // Check for global flags |
| 72 | if (std::strcmp(arg1, "--help") == 0 || std::strcmp(arg1, "-h") == 0) { |
| 73 | return Command::Help; |
| 74 | } |
| 75 | if (std::strcmp(arg1, "--version") == 0 || std::strcmp(arg1, "-v") == 0) { |
| 76 | return Command::Version; |
| 77 | } |
| 78 | |
| 79 | return Command::None; |
| 80 | } |
| 81 | |
| 82 | QString commandName(Command cmd) |
| 83 | { |