16namespace sharg::detail
22class format_tdl :
public format_help
42 throw validation_error{
"Validation failed for option --export-help: "
43 "Value must be one of "
44 + detail::supported_exports +
"."};
61namespace sharg::detail
70 return tdl::BoolValue(v);
76 return tdl::IntValue(v);
82 return tdl::DoubleValue(
static_cast<double>(v));
88 return tdl::StringValue(v);
92auto to_tdl(
auto SHARG_DOXYGEN_ONLY(v))
94 return tdl::BoolValue(
false);
166 template <
typename option_type,
typename val
idator_t>
176 if (
auto const & validator_message =
config.
validator.get_help_page_message(); !validator_message.empty())
177 description +=
". " + validator_message;
186 tags.insert(
"advanced");
204 tags.insert(
"directory");
209 tags.insert(
"output");
213 tags.insert(
"directory");
214 tags.insert(
"output");
221 node.tags = std::move(tags);
222 node.value = tdl::StringValue{valueAsStr};
237 node.tags = std::move(tags);
238 node.value =
to_tdl(value);
249 template <
typename val
idator_t>
268 template <
typename option_type,
typename val
idator_t>
272 auto positional_default_message = [&value]() ->
std::string
287 if (
auto const & validator_message =
config.
validator.get_help_page_message(); !validator_message.empty())
288 return ". " + validator_message;
296 default_message = positional_default_message(),
309 node.value = tdl::StringValueList{};
313 node.value = tdl::StringValue{};
314 node.tags.insert(
"required");
336 info.metaInfo = tdl::MetaInfo{
344 [](
auto const & a,
auto const & v)
350 if (!executable_name.
empty())
352 info.metaInfo.executableName = executable_name[0];
354 for (
size_t i{1}; i < executable_name.
size(); ++i)
357 .name = executable_name[executable_name.
size() - i],
358 .tags = {
"basecommand"},
395 bool SHARG_DOXYGEN_ONLY(is_paragraph),
396 bool const SHARG_DOXYGEN_ONLY(advanced_only))
404 bool const SHARG_DOXYGEN_ONLY(advanced_only))
416 template <
typename val
idator_t>
Whether the option type is considered to be a container.
Definition detail/concept.hpp:38
std::string to_string(value_types &&... values)
Streams all parameters via std::ostringstream and returns a concatenated string.
Definition to_string.hpp:40
Option struct that is passed to the sharg::parser::add_option() function.
Definition config.hpp:43
std::string description
The description to be shown on any (exported) help page.
Definition config.hpp:68
std::string long_id
The long identifier for the option (e.g. "age", making the option callable via --age).
Definition config.hpp:62
bool hidden
Whether the option should be hidden.
Definition config.hpp:117
bool advanced
Whether the option should only be displayed on the advanced help page.
Definition config.hpp:105
bool required
Whether the option is required.
Definition config.hpp:129
validator_t validator
A sharg::validator that verifies the value after parsing (callable).
Definition config.hpp:135
std::string default_message
The default message to be shown on any (exported) help page.
Definition config.hpp:87
Provides some standard validators for (positional) options.