From 17a3ea880402338420699e03bcb24181e4ff3924 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Thu, 2 May 2024 20:27:40 +0200 Subject: Initial commit Based on dc4ba6a --- src/querykv1/cliopts.hpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/querykv1/cliopts.hpp (limited to 'src/querykv1/cliopts.hpp') diff --git a/src/querykv1/cliopts.hpp b/src/querykv1/cliopts.hpp new file mode 100644 index 0000000..df8630e --- /dev/null +++ b/src/querykv1/cliopts.hpp @@ -0,0 +1,35 @@ +// vim:set sw=2 ts=2 sts et: + +#ifndef OEUF_QUERYKV1_CLIOPTS_HPP +#define OEUF_QUERYKV1_CLIOPTS_HPP + +#include + +#define LONG_OPTIONS \ +/* name req/opt/no arg long short */ + X(kv1_file_path, required_argument, "kv1", 0 ) \ + X(line_planning_number, required_argument, "line", 0 ) \ + X(journey_number, required_argument, "journey", 0 ) \ + X(journey_pattern_code, required_argument, "jopa", 0 ) \ + X(begin_stop_code, required_argument, "begin", 0 ) \ + X(end_stop_code, required_argument, "end", 0 ) \ + X(help, no_argument, "help", 'h') + +#define SHORT_OPTIONS \ + X(output_file_path, required_argument, nullptr, 'o') + +struct Options { + const char *subcommand = nullptr; + std::vector positional; +#define X(name, argument, long_, short_) const char *name = nullptr; + LONG_OPTIONS + SHORT_OPTIONS +#undef X +}; + +extern const char *opt_set; +extern const char *opt_unset; + +Options parseOptions(int argc, char *argv[]); + +#endif // OEUF_QUERYKV1_CLIOPTS_HPP -- cgit v1.2.3