2019-05-12 00:02:31 +02:00
|
|
|
/* This file is part of remwharead.
|
|
|
|
* Copyright © 2019 tastytea <tastytea@tastytea.de>
|
|
|
|
*
|
|
|
|
* This program 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, version 3.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REMWHAREAD_PARSE_OPTIONS_HPP
|
|
|
|
#define REMWHAREAD_PARSE_OPTIONS_HPP
|
|
|
|
|
2019-09-30 13:20:36 +02:00
|
|
|
#include "types.hpp"
|
2019-08-06 17:14:32 +02:00
|
|
|
#include <Poco/Util/Application.h>
|
|
|
|
#include <Poco/Util/OptionSet.h>
|
2019-09-30 13:20:36 +02:00
|
|
|
#include <array>
|
|
|
|
#include <chrono>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-05-12 00:02:31 +02:00
|
|
|
|
2019-09-25 03:58:29 +02:00
|
|
|
namespace remwharead_cli
|
2019-05-12 00:02:31 +02:00
|
|
|
{
|
2019-09-30 13:20:36 +02:00
|
|
|
using namespace remwharead;
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
using std::array;
|
|
|
|
using std::chrono::system_clock;
|
|
|
|
using time_point = system_clock::time_point;
|
|
|
|
using Poco::Util::OptionSet;
|
2019-09-25 03:58:29 +02:00
|
|
|
|
2019-09-30 13:20:36 +02:00
|
|
|
class App : public Poco::Util::Application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
App();
|
2019-05-12 20:19:00 +02:00
|
|
|
|
2019-09-30 13:20:36 +02:00
|
|
|
protected:
|
|
|
|
void defineOptions(OptionSet& options) override;
|
|
|
|
void handle_options(const string &name, const string &value);
|
2019-10-10 14:36:59 +02:00
|
|
|
void print_help(const string &option);
|
2020-01-27 06:32:28 +01:00
|
|
|
static void print_version();
|
2019-09-30 13:20:36 +02:00
|
|
|
int main(const std::vector<string> &args) override;
|
2019-05-12 00:02:31 +02:00
|
|
|
|
2019-09-30 13:20:36 +02:00
|
|
|
private:
|
2019-10-10 14:36:59 +02:00
|
|
|
bool _exit_requested;
|
2019-09-30 13:20:36 +02:00
|
|
|
bool _argument_error;
|
|
|
|
string _uri;
|
|
|
|
vector<string> _tags;
|
|
|
|
export_format _format;
|
|
|
|
string _file;
|
|
|
|
array<time_point, 2> _timespan;
|
|
|
|
string _search_tags;
|
|
|
|
string _search_all;
|
|
|
|
bool _archive;
|
|
|
|
bool _regex;
|
|
|
|
};
|
2019-09-25 03:58:29 +02:00
|
|
|
} // namespace remwharead_cli
|
2019-05-12 00:02:31 +02:00
|
|
|
|
|
|
|
#endif // REMWHAREAD_PARSE_OPTIONS_HPP
|