Skip to content

Commit

Permalink
fix a typo in the help text for --output-compression, dont allow unkn…
Browse files Browse the repository at this point in the history
…own compression method arguments for that options
  • Loading branch information
patrickbr committed Dec 2, 2024
1 parent d7db303 commit 0e754cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/osm2rdf/config/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const static inline std::string OUTPUT_COMPRESS_OPTION_SHORT = "";
const static inline std::string OUTPUT_COMPRESS_OPTION_LONG =
"output-compression";
const static inline std::string OUTPUT_COMPRESS_OPTION_HELP =
"Output file compression, valid values: none, bz2, gz2";
"Output file compression, valid values: none, bz2, gz";

const static inline std::string STORE_LOCATIONS_INFO =
"Storing locations osmium locations:";
Expand Down
16 changes: 13 additions & 3 deletions src/config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,19 @@ void osm2rdf::config::Config::fromArgs(int argc, char** argv) {
// Output
output = outputOp->value();
outputFormat = outputFormatOp->value();
outputCompress = outputCompressOp->value() == "none"
? NONE
: (outputCompressOp->value() == "gz" ? GZ : BZ2);
if (outputCompressOp->value() == "none") {
outputCompress = NONE;
} else if (outputCompressOp->value() == "gz") {
outputCompress = GZ;
} else if (outputCompressOp->value() == "bz2") {
outputCompress = BZ2;
} else {
throw popl::invalid_option(
outputCompressOp.get(),
popl::invalid_option::Error::invalid_argument,
popl::OptionName::long_name, outputCompressOp->value(), "");
}

outputKeepFiles = outputKeepFilesOp->is_set();
if (output.empty()) {
outputCompress = NONE;
Expand Down

0 comments on commit 0e754cf

Please sign in to comment.