4 #include <boost/algorithm/string/trim.hpp>
5 #include <boost/foreach.hpp>
6 #include <boost/program_options.hpp>
22 return !duplicates.
regist(moves);
26 int main(
int argc,
char **argv)
28 namespace bp = boost::program_options;
30 bp::options_description command_line_options;
31 command_line_options.add_options()
32 (
"input-file", bp::value<std::vector<std::string> >(),
33 "input files in the CSA format")
34 (
"help",
"Show help message");
36 bp::positional_options_description p;
37 p.add(
"input-file", -1);
41 bp::command_line_parser(argc, argv).options(command_line_options).positional(p).
run(), vm);
43 if (vm.count(
"help")) {
44 std::cerr <<
"Filter duplicated records from specified CSA files.\n";
45 std::cerr <<
"Usage: " << argv[0] <<
" [options] csa-file [...]\n";
46 std::cerr <<
" " << argv[0] <<
" [options]\n";
47 std::cout << command_line_options << std::endl;
50 }
catch (std::exception &e) {
51 std::cerr <<
"error in parsing options" << std::endl
52 << e.what() << std::endl;
53 std::cerr <<
"Filter duplicated records from specified CSA files.\n";
54 std::cerr <<
"Usage: " << argv[0] <<
" [options] csa-file [...]\n";
55 std::cerr <<
" " << argv[0] <<
" [options]\n";
56 std::cerr << command_line_options << std::endl;
60 std::vector<std::string>
files;
61 if (vm.count(
"input-file")) {
62 const std::vector<std::string> temp = vm[
"input-file"].as<std::vector<std::string> >();
63 files.insert(files.end(), temp.begin(), temp.end());
66 while(std::getline(std::cin , line)) {
67 boost::algorithm::trim(line);
68 files.push_back(line);
74 BOOST_FOREACH(
const std::string& file, files) {
76 std::cout << file << std::endl;
79 check_duplicate.
print(std::cerr);