src/CLIParser.h
branchv_0
changeset 1 e04e5bbc147b
parent 0 1bb084f84eb9
equal deleted inserted replaced
0:1bb084f84eb9 1:e04e5bbc147b
    55 
    55 
    56 	Style parseStyle(relpipe::common::type::StringX style) {
    56 	Style parseStyle(relpipe::common::type::StringX style) {
    57 		if (style == L"auto") return Style::Automatic;
    57 		if (style == L"auto") return Style::Automatic;
    58 		else if (style == L"dropped") return Style::Dropped;
    58 		else if (style == L"dropped") return Style::Dropped;
    59 		else if (style == L"literal") return Style::Literal;
    59 		else if (style == L"literal") return Style::Literal;
    60 		else if (style == L"literal-with-section-attribute") return Style::LiteralWithSectionAttribute; // TODO: better names
    60 		else if (style == L"section-first") return Style::SectionFirst;
    61 		else if (style == L"standard") return Style::Standard;
    61 		else if (style == L"standard") return Style::Standard;
    62 		else throw relpipe::cli::RelpipeCLIException(L"Unsupported style option: " + style, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    62 		else throw relpipe::cli::RelpipeCLIException(L"Unsupported style option: " + style, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    63 	}
    63 	}
    64 
    64 
    65 public:
    65 public:
    78 			if (option == OPTION_RELATION) {
    78 			if (option == OPTION_RELATION) {
    79 				addRelation(c, currentRelation); // previous relation
    79 				addRelation(c, currentRelation); // previous relation
    80 				currentRelation.relation = readNext(arguments, i);
    80 				currentRelation.relation = readNext(arguments, i);
    81 			} else if (option == OPTION_STYLE) {
    81 			} else if (option == OPTION_STYLE) {
    82 				currentRelation.style = parseStyle(readNext(arguments, i));
    82 				currentRelation.style = parseStyle(readNext(arguments, i));
       
    83 				if (currentRelation.relation.empty()) currentRelation.relation = L".*";
    83 			} else if (option == OPTION_WRITER_OPTION) {
    84 			} else if (option == OPTION_WRITER_OPTION) {
    84 				c.writerOptions.push_back({readNext(arguments, i), readNext(arguments, i)});
    85 				c.writerOptions.push_back({readNext(arguments, i), readNext(arguments, i)});
    85 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    86 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    86 		}
    87 		}
    87 		addRelation(c, currentRelation); // last relation
    88 		addRelation(c, currentRelation); // last relation