1#ifndef KOUTIL_ARGS_OPTION_BUILDER_H
2#define KOUTIL_ARGS_OPTION_BUILDER_H
63 return std::move(*
this);
73 return std::move(*
this);
83 return std::move(*
this);
92 template <
void_handle<std::optional<std::
string_view>, result_t&> Handle>
95 return std::move(*
this);
110 template <
void_handle<std::optional<std::
string_view>, result_t&> Handle>
option_t build(Handle&&
handle) && {
Builder for creating command-line options.
Definition option_builder.h:29
option_data_t m_data
Definition option_builder.h:116
option_t< result_t > option_t
Definition option_builder.h:32
option_builder_t && has_value(bool value=true) &&
Marks the option as one that expects a value.
Definition option_builder.h:81
option_builder_t(std::string_view long_name)
Constructs a builder with only a long name.
Definition option_builder.h:54
option_t build(Handle &&handle) &&
Builds the option with an explicit handler.
Definition option_builder.h:110
option_t build() &&
Builds the option with the configured properties.
Definition option_builder.h:102
Result result_t
Definition option_builder.h:31
option_t::handle_t m_handle
Definition option_builder.h:117
option_builder_t && description(std::string_view description) &&
Sets the option description.
Definition option_builder.h:61
option_builder_t(char short_name, std::string_view long_name)
Constructs a builder with both short and long names.
Definition option_builder.h:39
option_builder_t(char short_name)
Constructs a builder with only a short name.
Definition option_builder.h:48
option_builder_t && required(bool required=true) &&
Marks the option as required.
Definition option_builder.h:71
option_builder_t && handle(Handle &&handle) &&
Assigns a handler function to the option.
Definition option_builder.h:93
std::function< void(std::optional< std::string_view >, result_t &)> handle_t
Type alias for option handler function.
Definition option.h:45
Holds metadata for an option.
Definition option.h:22
std::string_view description
Description of the option.
Definition option.h:25
std::optional< char > short_name
Short form name (without "-").
Definition option.h:24
bool has_value
True if the option expects a value.
Definition option.h:27
std::optional< std::string_view > long_name
Long form name (without "--").
Definition option.h:23
bool required
True if the option is mandatory.
Definition option.h:28