Euphoria
|
argparse.h File Reference
#include <map>
#include <memory>
#include <optional>
#include <functional>
#include <type_traits>
#include "base/default_parse.h"
#include "base/stringmerger.h"
#include "base/result.h"
Go to the source code of this file.
Classes | |
struct | eu::core::argparse::FileOutput |
option where the output can either be a single file or "infinite" More... | |
struct | eu::core::argparse::ParseResult |
struct | eu::core::argparse::NameAndArguments |
container for arguments passed to main More... | |
struct | eu::core::argparse::ArgumentReader |
"file" like api for reading arguments More... | |
struct | eu::core::argparse::Printer |
generic output class More... | |
struct | eu::core::argparse::ConsolePrinter |
console output More... | |
struct | eu::core::argparse::Runner |
shared data between parsing functions More... | |
struct | eu::core::argparse::Name |
represents a command line argument optional: More... | |
struct | eu::core::argparse::Argument |
base class for argument More... | |
struct | eu::core::argparse::ArgumentAndName |
named tuple class for argument and name More... | |
struct | eu::core::argparse::ArgumentNoValue |
a argument with no value, probably either a –set-true or a void function like –help More... | |
struct | eu::core::argparse::SingleArgument |
a single argument, probably either a –count 3 or positional input More... | |
struct | eu::core::argparse::MultiArgument |
a single argument, probably either a –count 3 or positional input More... | |
struct | eu::core::argparse::SubParserNames |
valid names for a single subparser example: [checkout, co] or [pull] More... | |
struct | eu::core::argparse::SubParserContainer |
data about a subparser More... | |
struct | eu::core::argparse::SubParserGroup |
subparsers can be grouped and this structs represents that group More... | |
struct | eu::core::argparse::ParserBase |
base for the parser, start with Parser and add one or more subparsers More... | |
struct | eu::core::argparse::SubParser |
subparser, don't create manually but add to a existing parser AddSubParsers()->Add(...); More... | |
struct | eu::core::argparse::Parser |
root parser. start argumentparsing with this one More... | |
Namespaces | |
eu | |
eu::core | |
eu::core::argparse | |
Typedefs | |
template<typename T > | |
using | eu::core::argparse::ParseFunction = std::function< Result< T >(const std::string &value)> |
generic parse function More... | |
using | eu::core::argparse::SubParserCallback = std::function< ParseResult(SubParser *)> |
using | eu::core::argparse::CompleteFunction = std::function< ParseResult()> |
Enumerations | |
enum class | eu::core::argparse::State { eu::core::argparse::adding , eu::core::argparse::parsing } |
enum to catch adding arguments during parsing in a callback More... | |
enum class | eu::core::argparse::SubParserStyle { eu::core::argparse::greedy , eu::core::argparse::fallback , eu::core::argparse::inherit } |
how the subparsing is handled, non-greedy are useful for 'scripting' with subparsers More... | |
Functions | |
std::string | eu::core::argparse::to_string (const ParseResult &pr) |
ADD_DEFAULT_FORMATTER (eu::core::argparse::ParseResult, std::string, eu::core::argparse::to_string) | |
bool | eu::core::argparse::operator== (const ParseResult &lhs, const ParseResult &rhs) |
bool | eu::core::argparse::operator!= (const ParseResult &lhs, const ParseResult &rhs) |
std::string | eu::core::argparse::to_string (const eu::core::argparse::NameAndArguments &args) |
ADD_DEFAULT_FORMATTER (eu::core::argparse::NameAndArguments, std::string, eu::core::argparse::to_string) | |
void | eu::core::argparse::print_parse_error (Runner *runner, ParserBase *base, const std::string &error_message) |
int | eu::core::argparse::parse_from_main (Parser *parser, int argc, char *argv[]) |
helper function for parsing directly from main More... | |
Variables | |
constexpr ParseResult | eu::core::argparse::error = ParseResult{ ParseResult::Type::error } |
no error occurred More... | |
constexpr ParseResult | eu::core::argparse::ok = ParseResult{ ParseResult::Type::ok } |
all ok More... | |
constexpr ParseResult | eu::core::argparse::quit = ParseResult{ ParseResult::Type::quit } |
all ok, but quit requested More... | |
Function Documentation
◆ ADD_DEFAULT_FORMATTER() [1/2]
ADD_DEFAULT_FORMATTER | ( | eu::core::argparse::NameAndArguments | , |
std::string | , | ||
eu::core::argparse::to_string | |||
) |
◆ ADD_DEFAULT_FORMATTER() [2/2]
ADD_DEFAULT_FORMATTER | ( | eu::core::argparse::ParseResult | , |
std::string | , | ||
eu::core::argparse::to_string | |||
) |