19#if __has_include(<seqan3/version.hpp>)
20# include <seqan3/version.hpp>
23namespace sharg::detail
37 template <
typename value_type>
43 return "signed 8 bit integer";
45 return "unsigned 8 bit integer";
47 return "signed 16 bit integer";
49 return "unsigned 16 bit integer";
51 return "signed 32 bit integer";
53 return "unsigned 32 bit integer";
55 return "signed 64 bit integer";
57 return "unsigned 64 bit integer";
69 return "std::filesystem::path";
71 return sharg::detail::type_name_as_string<value_type>;
78 template <detail::is_container_option container_type>
81 typename container_type::value_type tmp{};
90 template <
typename option_value_type>
102 template <detail::is_container_option container_type>
119 if (short_id !=
'\0')
122 if (short_id !=
'\0' && !long_id.
empty())
125 if (!long_id.
empty())
126 term.
append(
"\fB--" + long_id +
"\fP");
142 for (
auto c : original)
170 auto it{flag_cluster.
begin()};
172 if (flag_cluster[0] ==
'-')
175 for (; it != flag_cluster.
end() - 1; ++it)
176 tmp.
append({
'-', *it,
',',
' '});
179 tmp.
append({
'a',
'n',
'd',
' ',
'-', flag_cluster[flag_cluster.
size() - 1]});
196 template <
typename option_type,
typename default_type>
202 message <<
" Default: ";
209 auto view = std::views::transform(value,
229 static constexpr bool needs_string_quote = option_is_string || (option_is_path && value_is_string);
231 if constexpr (needs_string_quote)
237 return message.str();
246template <
typename derived_type>
267 bool const advanced) :
278 template <
typename option_type,
typename val
idator_t>
289 if (
auto const & validator_message =
config.
validator.get_help_page_message(); !validator_message.empty())
290 info +=
". " + validator_message;
303 template <
typename val
idator_t>
309 derived_t().print_list_item(id, description);
317 template <
typename option_type,
typename val
idator_t>
321 auto positional_default_message = [&value]() ->
std::string
336 if (
auto const & validator_message =
config.
validator.get_help_page_message(); !validator_message.empty())
337 return ". " + validator_message;
345 default_message = positional_default_message(),
346 validator_message = positional_validator_message(),
354 description + default_message + validator_message);
375 derived_t().print_section(
"Description");
382 derived_t().print_section(
"Subcommands");
383 derived_t().print_line(
"This program must be invoked with one of the following subcommands:",
false);
385 derived_t().print_line(
"- \fB" + name +
"\fP",
false);
386 derived_t().print_line(
"See the respective help page for further details (e.g. by calling " +
meta.
app_name
389 derived_t().print_line(
"The following options belong to the top-level parser and need to be "
390 "specified \fBbefore\fP the subcommand key word. Every argument after the "
391 "subcommand key word is passed on to the corresponding sub-parser.",
397 derived_t().print_section(
"Positional Arguments");
411 derived_t().print_subsection(
"Common options");
412 derived_t().print_list_item(
"\fB-h\fP, \fB--help\fP",
"Prints the help page.");
413 derived_t().print_list_item(
"\fB-hh\fP, \fB--advanced-help\fP",
414 "Prints the help page including advanced options.");
415 derived_t().print_list_item(
"\fB--version\fP",
"Prints the version information.");
416 derived_t().print_list_item(
"\fB--copyright\fP",
"Prints the copyright/license information.");
417 derived_t().print_list_item(
"\fB--export-help\fP (std::string)",
418 "Export the help page information. Value must be one of "
419 + detail::supported_exports +
".");
421 derived_t().print_list_item(
"\fB--version-check\fP (bool)",
422 "Whether to check for the newest app version. Default: true");
472 [
this, text, is_paragraph]()
474 derived_t().print_line(text, is_paragraph);
555#ifdef SEQAN3_VERSION_CSTRING
556 std::string const seqan3_version_str{seqan3::seqan3_version_cstring};
557 derived_t().print_line(
derived_t().in_bold(
"SeqAn version: ") + seqan3_version_str,
false);
593 +
"2006-2024 Knut Reinert, FU-Berlin; released under the 3-clause BSDL.",
604 derived_t().print_line(
"For full copyright and/or warranty information see "
605 +
derived_t().in_bold(
"--copyright") +
".",
650 template <
typename val
idator_t>
Provides auxiliary information.
Whether the option type is considered to be a container.
Definition detail/concept.hpp:38
Provides sharg::config class.
Provides the concept sharg::detail::is_container_option.
T find_first_of(T... args)
T find_last_of(T... args)
std::string to_string(value_types &&... values)
Streams all parameters via std::ostringstream and returns a concatenated string.
Definition to_string.hpp:40
update_notifications
Indicates whether application allows automatic update notifications by the sharg::parser.
Definition auxiliary.hpp:26
@ on
Automatic update notifications should be enabled.
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
char short_id
The short identifier for the option (e.g. 'a', making the option callable via -a).
Definition config.hpp:53
std::string default_message
The default message to be shown on any (exported) help page.
Definition config.hpp:87
Provides traits to inspect some information of a type, for example its name.
Provides some standard validators for (positional) options.
constexpr char const * sharg_version_cstring
The full version as null terminated string.
Definition version.hpp:64