diff options
| author | Rutger Broekhoff | 2024-05-02 20:27:40 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2024-05-02 20:27:40 +0200 |
| commit | 17a3ea880402338420699e03bcb24181e4ff3924 (patch) | |
| tree | da666ef91e0b60d20aa0b01529644c136fd1f4ab /src/querykv1/cliopts.hpp | |
| download | oeuf-17a3ea880402338420699e03bcb24181e4ff3924.tar.gz oeuf-17a3ea880402338420699e03bcb24181e4ff3924.zip | |
Initial commit
Based on dc4ba6a
Diffstat (limited to 'src/querykv1/cliopts.hpp')
| -rw-r--r-- | src/querykv1/cliopts.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ | |||
| 1 | // vim:set sw=2 ts=2 sts et: | ||
| 2 | |||
| 3 | #ifndef OEUF_QUERYKV1_CLIOPTS_HPP | ||
| 4 | #define OEUF_QUERYKV1_CLIOPTS_HPP | ||
| 5 | |||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #define LONG_OPTIONS \ | ||
| 9 | /* name req/opt/no arg long short */ | ||
| 10 | X(kv1_file_path, required_argument, "kv1", 0 ) \ | ||
| 11 | X(line_planning_number, required_argument, "line", 0 ) \ | ||
| 12 | X(journey_number, required_argument, "journey", 0 ) \ | ||
| 13 | X(journey_pattern_code, required_argument, "jopa", 0 ) \ | ||
| 14 | X(begin_stop_code, required_argument, "begin", 0 ) \ | ||
| 15 | X(end_stop_code, required_argument, "end", 0 ) \ | ||
| 16 | X(help, no_argument, "help", 'h') | ||
| 17 | |||
| 18 | #define SHORT_OPTIONS \ | ||
| 19 | X(output_file_path, required_argument, nullptr, 'o') | ||
| 20 | |||
| 21 | struct Options { | ||
| 22 | const char *subcommand = nullptr; | ||
| 23 | std::vector<const char *> positional; | ||
| 24 | #define X(name, argument, long_, short_) const char *name = nullptr; | ||
| 25 | LONG_OPTIONS | ||
| 26 | SHORT_OPTIONS | ||
| 27 | #undef X | ||
| 28 | }; | ||
| 29 | |||
| 30 | extern const char *opt_set; | ||
| 31 | extern const char *opt_unset; | ||
| 32 | |||
| 33 | Options parseOptions(int argc, char *argv[]); | ||
| 34 | |||
| 35 | #endif // OEUF_QUERYKV1_CLIOPTS_HPP | ||