48 |
48 |
49 public: |
49 public: |
50 |
50 |
51 static const relpipe::writer::string_t OPTION_RELATION; |
51 static const relpipe::writer::string_t OPTION_RELATION; |
52 static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS; |
52 static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS; |
53 static const relpipe::writer::string_t OPTION_ENABLE_SUBKEYS; |
53 static const relpipe::writer::string_t OPTION_ENABLE_SUB_KEYS; |
54 static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS; |
54 static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS; |
55 static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS; |
55 static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS; |
56 static const relpipe::writer::string_t OPTION_ENABLE_EVENT_NUMBERS; |
56 static const relpipe::writer::string_t OPTION_ENABLE_EVENT_NUMBERS; |
57 |
57 |
58 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
58 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
61 for (int i = 0; i < arguments.size();) { |
61 for (int i = 0; i < arguments.size();) { |
62 relpipe::writer::string_t option = readNext(arguments, i); |
62 relpipe::writer::string_t option = readNext(arguments, i); |
63 |
63 |
64 if (option == OPTION_RELATION) c.relation = readNext(arguments, i); |
64 if (option == OPTION_RELATION) c.relation = readNext(arguments, i); |
65 else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i)); |
65 else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i)); |
66 else if (option == OPTION_ENABLE_SUBKEYS) c.enableSubkeys = parseBoolean(readNext(arguments, i)); |
66 else if (option == OPTION_ENABLE_SUB_KEYS) c.enableSubKeys = parseBoolean(readNext(arguments, i)); |
67 else if (option == OPTION_ENABLE_COMMENTS) c.enableComments = parseBoolean(readNext(arguments, i)); |
67 else if (option == OPTION_ENABLE_COMMENTS) c.enableComments = parseBoolean(readNext(arguments, i)); |
68 else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i)); |
68 else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i)); |
69 else if (option == OPTION_ENABLE_EVENT_NUMBERS) c.enableEventNumbers = parseBoolean(readNext(arguments, i)); |
69 else if (option == OPTION_ENABLE_EVENT_NUMBERS) c.enableEventNumbers = parseBoolean(readNext(arguments, i)); |
70 else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
70 else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
71 } |
71 } |
77 } |
77 } |
78 }; |
78 }; |
79 |
79 |
80 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
80 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
81 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections"; |
81 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections"; |
82 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUBKEYS = L"--enable-subkeys"; |
82 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUB_KEYS = L"--enable-sub-keys"; |
83 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_COMMENTS = L"--enable-comments"; |
83 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_COMMENTS = L"--enable-comments"; |
84 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers"; |
84 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers"; |
85 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_EVENT_NUMBERS = L"--enable-event-numbers"; |
85 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_EVENT_NUMBERS = L"--enable-event-numbers"; |
86 |
86 |
87 } |
87 } |