UsenetSearch/src/tokendump.cpp

46 lines
1.4 KiB
C++

/*
Copyright© 2021 John Sennesael
UsenetSearch is Free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UsenetSearch is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UsenetSearch. If not, see <https://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <string>
#include "usenetsearch/Application.h"
#include "usenetsearch/StringUtils.h"
using namespace usenetsearch;
int main(int argc, char* argv[])
{
Application app;
std::string dbFile{""};
app.AddFileOption(
'd',
"token db file to dump.",
[&dbFile](const std::string& val)
{
dbFile = val;
}
);
app.Init(argc, argv);
app.GetDb().ParseTokenFile(dbFile, [](const ArticleEntry& token){
std::cout << "Hash: " << HashBytesToString(token.hash) << " | "
<< "NewsgroupID: " << token.newsgroupID << " | "
<< "ArticleID: " << token.articleID << std::endl;
});
return 0;
}