Buddies: added option to concatenate files with '+'

This commit is contained in:
Matthias Koefferlein 2020-08-23 21:13:02 +02:00
parent be15e2dbf6
commit dcc0743969
1 changed files with 10 additions and 4 deletions

View File

@ -41,7 +41,9 @@ int converter_main (int argc, char *argv[], const std::string &format)
generic_writer_options.add_options (cmd, format);
generic_reader_options.add_options (cmd);
cmd << tl::arg ("input", &infile, "The input file (any format, may be gzip compressed)")
cmd << tl::arg ("input", &infile, "The input file (any format, may be gzip compressed)",
"You can use '+' to supply multiple files which will be read after each other into the same layout. "
"This provides some cheap, but risky way of merging files. Beware of cell name conflicts.")
<< tl::arg ("output", &outfile, tl::sprintf ("The output file (%s format)", format))
;
@ -55,9 +57,13 @@ int converter_main (int argc, char *argv[], const std::string &format)
db::LoadLayoutOptions load_options;
generic_reader_options.configure (load_options);
tl::InputStream stream (infile);
db::Reader reader (stream);
reader.read (layout, load_options);
std::vector<std::string> files = tl::split (infile, "+");
for (std::vector<std::string>::const_iterator f = files.begin (); f != files.end (); ++f) {
tl::InputStream stream (*f);
db::Reader reader (stream);
reader.read (layout, load_options);
}
}
{