1#ifndef KOUTIL_ARGS_ARGUMENT_H
2#define KOUTIL_ARGS_ARGUMENT_H
18template <extends_result Result = result_base_t>
class argument_t {
42 template <
void_handle<std::
string_view, result_t&> Handle>
46 ,
m_handle(std::forward<Handle>(handle)) { }
52 [[nodiscard]] std::string_view
name()
const {
return m_name; }
76 m_handle(value, result);
Represents a positional command-line argument.
Definition argument.h:18
std::string_view m_name
Definition argument.h:68
argument_t(std::string_view name, std::string_view description)
Constructs an argument with a name and description.
Definition argument.h:30
std::string_view m_description
Definition argument.h:69
Result result_t
Definition argument.h:20
std::function< void(std::string_view, result_t &)> handle_t
Type alias for argument handler function.
Definition argument.h:23
std::string_view name() const
Gets the argument name.
Definition argument.h:52
std::string_view description() const
Gets the argument description.
Definition argument.h:58
argument_t(std::string_view name, std::string_view description, Handle &&handle)
Constructs an argument with a name, description, and handler.
Definition argument.h:43
void process(std::string_view value, result_t &result) const
Processes the argument value using the assigned handler.
Definition argument.h:74
handle_t m_handle
Definition argument.h:71