Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
parser_options.hpp
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <map>
4#include <vector>
5#include <getopt.h>
6
8
15
16struct CliOption {
17 const char *long_name;
20 const char *description {""};
21};
22
26#define OPTION_END {nullptr, 0, NoArgument, nullptr}
27
36 std::map<std::string, std::string> args;
37
41 std::vector<std::string> extra_args;
42};
43
56bool parse_options(int argc, char* argv[], const std::vector<CliOption>& options, ParsedOptions& ctx_options);
bool parse_options(int argc, char *argv[], const std::vector< CliOption > &options, ParsedOptions &ctx_options)
Analyzes command-line arguments and populates ParsedOptions.
ArgumentsType
@ RequiredArgument
@ OptionalArgument
@ NoArgument
@ PositionalArgument
ArgumentsType has_arg
const char * long_name
const char * description
std::vector< std::string > extra_args
List of extra arguments that are not options.
std::map< std::string, std::string > args
Map from option name to value.