# HG changeset patch # User František Kučera # Date 1547929286 -3600 # Node ID 6180161335be978551943a867b416bb65319d38a # Parent e7f05d7c43362c11fd753f8af37b0ce9dc4f7159 support custom relation name through --relation option diff -r e7f05d7c4336 -r 6180161335be src/CLIParser.h --- a/src/CLIParser.h Sat Jan 19 21:16:39 2019 +0100 +++ b/src/CLIParser.h Sat Jan 19 21:21:26 2019 +0100 @@ -56,6 +56,7 @@ static const string_t OPTION_XATTR; static const string_t OPTION_AS; static const string_t OPTION_OPTION; + static const string_t OPTION_RELATION; Configuration parse(const std::vector& arguments) { Configuration c; @@ -78,6 +79,8 @@ } else if (option == OPTION_OPTION) { currentOptions.push_back(readNext(arguments, i)); currentOptions.push_back(readNext(arguments, i)); + } else if (option == OPTION_RELATION) { + c.relation = readNext(arguments, i); } else { throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); } @@ -114,6 +117,7 @@ const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR; const string_t CLIParser::OPTION_AS = L"--as"; const string_t CLIParser::OPTION_OPTION = L"--option"; +const string_t CLIParser::OPTION_RELATION = L"--relation"; } } diff -r e7f05d7c4336 -r 6180161335be src/Configuration.h --- a/src/Configuration.h Sat Jan 19 21:16:39 2019 +0100 +++ b/src/Configuration.h Sat Jan 19 21:21:26 2019 +0100 @@ -29,6 +29,7 @@ class Configuration { public: + string_t relation; std::vector fields; virtual ~Configuration() { diff -r e7f05d7c4336 -r 6180161335be src/FilesystemCommand.h --- a/src/FilesystemCommand.h Sat Jan 19 21:16:39 2019 +0100 +++ b/src/FilesystemCommand.h Sat Jan 19 21:21:26 2019 +0100 @@ -82,7 +82,8 @@ else throw RelpipeWriterException(L"Unsupported field group: " + field.group); } - writer->startRelation(L"filesystem", attributesMetadata, true); + string_t relationName = configuration.relation.empty() ? L"filesystem" : configuration.relation; + writer->startRelation(relationName, attributesMetadata, true); for (std::stringstream originalName; readNext(input, originalName); reset(originalName)) {