Sharg 1.2.0-rc.2
The argument parser for bio-c++ tools.
Loading...
Searching...
No Matches
parser.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <unordered_set>
13#include <variant>
14
15#include <sharg/config.hpp>
22
23namespace sharg
24{
25
158{
159public:
163 parser() = delete;
164 parser(parser const &) = delete;
165 parser & operator=(parser const &) = delete;
166 parser(parser &&) = default;
167 parser & operator=(parser &&) = default;
168
189 version_check_dev_decision{version_updates},
190 arguments{std::move(arguments)}
191 {
193 info.app_name = std::move(app_name);
194 }
195
198 int const argc,
199 char const * const * const argv,
202 parser{std::move(app_name), std::vector<std::string>{argv, argv + argc}, version_updates, subcommands}
203 {}
204
207 {
208 // wait for another 3 seconds
209 if (version_check_future.valid())
210 version_check_future.wait_for(std::chrono::seconds(3));
211 }
213
242 template <typename option_type, typename validator_type>
245 void add_option(option_type & value, config<validator_type> const & config)
246 {
247 check_parse_not_called("add_option");
248 verify_option_config(config);
249
250 auto operation = [this, &value, config]()
251 {
252 auto visit_fn = [&value, &config](auto & f)
253 {
254 f.add_option(value, config);
255 };
256
257 std::visit(std::move(visit_fn), format);
258 };
259
260 operations.push_back(std::move(operation));
261 }
262
276 template <typename validator_type>
278 void add_flag(bool & value, config<validator_type> const & config)
279 {
280 check_parse_not_called("add_flag");
281 verify_flag_config(config);
282
283 if (value)
284 throw design_error("A flag's default value must be false.");
285
286 auto operation = [this, &value, config]()
287 {
288 auto visit_fn = [&value, &config](auto & f)
289 {
290 f.add_flag(value, config);
291 };
292
293 std::visit(std::move(visit_fn), format);
294 };
295
296 operations.push_back(std::move(operation));
297 }
298
326 template <typename option_type, typename validator_type>
329 void add_positional_option(option_type & value, config<validator_type> const & config)
330 {
331 check_parse_not_called("add_positional_option");
332 verify_positional_option_config(config);
333
335 has_positional_list_option = true; // keep track of a list option because there must be only one!
336
337 auto operation = [this, &value, config]()
338 {
339 auto visit_fn = [&value, &config](auto & f)
340 {
341 f.add_positional_option(value, config);
342 };
343
344 std::visit(std::move(visit_fn), format);
345 };
346
347 operations.push_back(std::move(operation));
348 }
350
418 void parse()
419 {
420 if (parse_was_called)
421 throw design_error("The function parse() must only be called once!");
422
423 parse_was_called = true;
424
425 // User input sanitization must happen before version check!
426 verify_app_and_subcommand_names();
427
428 // Determine the format and subcommand.
429 determine_format_and_subcommand();
430
431 // Apply all defered operations to the parser, e.g., `add_option`, `add_flag`, `add_positional_option`.
432 for (auto & operation : operations)
433 operation();
434
435 // The version check, which might exit the program, must be called before calling parse on the format.
436 run_version_check();
437
438 // Parse the command line arguments.
439 parse_format();
440
441 // Exit after parsing any special format.
443 std::exit(EXIT_SUCCESS);
444 }
445
453 {
454 if (sub_parser == nullptr)
455 {
456 throw design_error("No subcommand was provided at the construction of the argument parser!");
457 }
458
459 return *sub_parser;
460 }
461
491 // clang-format off
492 template <typename id_type>
494 bool is_option_set(id_type const & id) const
495 // clang-format on
496 {
497 if (!parse_was_called)
498 throw design_error{"You can only ask which options have been set after calling the function `parse()`."};
499
500 detail::id_pair const id_pair{id};
501
502 if (id_pair.long_id.size() == 1u)
503 {
504 throw design_error{"Long option identifiers must be longer than one character! If " + id_pair.long_id
505 + "' was meant to be a short identifier, please pass it as a char ('') not a string"
506 " (\"\")!"};
507 }
508
509 auto const it = detail::id_pair::find(used_option_ids, id_pair);
510 if (it == used_option_ids.end())
511 throw design_error{"You can only ask for option identifiers that you added with add_option() before."};
512
513 // we only need to search for an option before the `option_end_identifier` (`--`)
514 auto option_end = std::ranges::find(format_arguments, option_end_identifier);
515 auto option_it = detail::format_parse::find_option_id(format_arguments.begin(), option_end, *it);
516 return option_it != option_end;
517 }
518
521
532 void add_section(std::string const & title, bool const advanced_only = false)
533 {
534 check_parse_not_called("add_section");
535
536 auto operation = [this, title, advanced_only]()
537 {
538 auto visit_fn = [&title, advanced_only](auto & f)
539 {
540 f.add_section(title, advanced_only);
541 };
542
543 std::visit(std::move(visit_fn), format);
544 };
545
546 operations.push_back(std::move(operation));
547 }
548
559 void add_subsection(std::string const & title, bool const advanced_only = false)
560 {
561 check_parse_not_called("add_subsection");
562
563 auto operation = [this, title, advanced_only]()
564 {
565 auto visit_fn = [&title, advanced_only](auto & f)
566 {
567 f.add_subsection(title, advanced_only);
568 };
569
570 std::visit(std::move(visit_fn), format);
571 };
572
573 operations.push_back(std::move(operation));
574 }
575
587 void add_line(std::string const & text, bool is_paragraph = false, bool const advanced_only = false)
588 {
589 check_parse_not_called("add_line");
590
591 auto operation = [this, text, is_paragraph, advanced_only]()
592 {
593 auto visit_fn = [&text, is_paragraph, advanced_only](auto & f)
594 {
595 f.add_line(text, is_paragraph, advanced_only);
596 };
597
598 std::visit(std::move(visit_fn), format);
599 };
600
601 operations.push_back(std::move(operation));
602 }
603
624 void add_list_item(std::string const & key, std::string const & desc, bool const advanced_only = false)
625 {
626 check_parse_not_called("add_list_item");
627
628 auto operation = [this, key, desc, advanced_only]()
629 {
630 auto visit_fn = [&key, &desc, advanced_only](auto & f)
631 {
632 f.add_list_item(key, desc, advanced_only);
633 };
634
635 std::visit(std::move(visit_fn), format);
636 };
637
638 operations.push_back(std::move(operation));
639 }
640
653 {
654 auto & parser_subcommands = this->subcommands;
655 parser_subcommands.insert(parser_subcommands.end(), subcommands.cbegin(), subcommands.cend());
656
657 std::ranges::sort(parser_subcommands);
658 auto const [first, last] = std::ranges::unique(parser_subcommands);
659 parser_subcommands.erase(first, last);
660 }
662
714
715private:
717 bool parse_was_called{false};
718
720 bool has_positional_list_option{false};
721
723 update_notifications version_check_dev_decision{};
724
727
729 friend struct ::sharg::detail::test_accessor;
730
733
735 std::regex app_name_regex{"^[a-zA-Z0-9_-]+$"};
736
738 static constexpr std::string_view const option_end_identifier{"--"};
739
741 std::unique_ptr<parser> sub_parser{nullptr};
742
745
762
764 std::unordered_set<detail::id_pair> used_option_ids{{'h', "help"},
765 {'\0' /*hh*/, "advanced-help"},
766 {'\0', "hh"},
767 {'\0', "export-help"},
768 {'\0', "version"},
769 {'\0', "copyright"}};
770
772 std::vector<std::string> format_arguments{};
773
776
778 std::vector<std::string> executable_name{};
779
782
785
814 {
815 assert(!arguments.empty());
816
817 auto it = arguments.begin();
818 std::string_view arg{*it};
819
820 executable_name.emplace_back(arg);
821
822 // Helper function for reading the next argument. This makes it more obvious that we are
823 // incrementing `it` (version-check, and export-help).
824 auto read_next_arg = [this, &it, &arg]() -> bool
825 {
826 assert(it != arguments.end());
827
828 if (++it == arguments.end())
829 return false;
830
831 arg = *it;
832 return true;
833 };
834
835 // Helper function for finding and processing subcommands.
836 auto found_subcommand = [this, &it, &arg]() -> bool
837 {
838 if (subcommands.empty())
839 return false;
840
841 auto copy_metadata_to_subparser = [this](parser & sub_parser)
842 {
843 sub_parser.info.version = info.version;
844 sub_parser.info.author = info.author;
845 sub_parser.info.email = info.email;
846 sub_parser.info.date = info.date;
847 sub_parser.info.url = info.url;
848 sub_parser.info.short_copyright = info.short_copyright;
849 sub_parser.info.long_copyright = info.long_copyright;
850 sub_parser.info.citation = info.citation;
851 };
852
853 if (std::ranges::find(subcommands, arg) != subcommands.end())
854 {
855 sub_parser = std::make_unique<parser>(info.app_name + "-" + arg.data(),
856 std::vector<std::string>{it, arguments.end()},
858 copy_metadata_to_subparser(get_sub_parser());
859
860 // Add the original calls to the front, e.g. ["raptor"],
861 // s.t. ["raptor", "build"] will be the list after constructing the subparser
862 sub_parser->executable_name.insert(sub_parser->executable_name.begin(),
863 executable_name.begin(),
864 executable_name.end());
865 return true;
866 }
867 else
868 {
869 // Positional options are forbidden by design.
870 // Flags and options, which both start with '-', are allowed for the top-level parser.
871 // Otherwise, this is an unknown subcommand.
872 if (!arg.starts_with('-'))
873 {
874 std::string message = "You specified an unknown subcommand! Available subcommands are: [";
875 for (std::string const & command : subcommands)
876 message += command + ", ";
877 message.replace(message.size() - 2, 2, "]. Use -h/--help for more information.");
878
879 throw user_input_error{message};
880 }
881 }
882
883 return false;
884 };
885
886 // Process the arguments.
887 for (; read_next_arg();)
888 {
889 // The argument is a known option.
890 if (options.contains(std::string{arg}))
891 {
892 // No futher checks are needed.
893 format_arguments.emplace_back(arg);
894
895 // Consume the next argument (the option value) if possible.
896 if (read_next_arg())
897 {
898 format_arguments.emplace_back(arg);
899 continue;
900 }
901 else // Too few arguments. This is handled by format_parse.
902 {
903 break;
904 }
905 }
906
907 // If we have a subcommand, all further arguments are passed to the subparser.
908 if (found_subcommand())
909 break;
910
911 if (arg == "-h" || arg == "--help")
912 {
913 format = detail::format_help{subcommands, version_check_dev_decision, false};
914 }
915 else if (arg == "-hh" || arg == "--advanced-help")
916 {
917 format = detail::format_help{subcommands, version_check_dev_decision, true};
918 }
919 else if (arg == "--version")
920 {
921 format = detail::format_version{};
922 }
923 else if (arg == "--copyright")
924 {
925 format = detail::format_copyright{};
926 }
927 else if (arg == "--export-help" || arg.starts_with("--export-help="))
928 {
929 arg.remove_prefix(std::string_view{"--export-help"}.size());
930
931 // --export-help man
932 if (arg.empty())
933 {
934 if (!read_next_arg())
935 throw too_few_arguments{"Option --export-help must be followed by a value."};
936 }
937 else // --export-help=man
938 {
939 arg.remove_prefix(1u);
940 }
941
942 if (arg == "html")
943 format = detail::format_html{subcommands, version_check_dev_decision};
944 else if (arg == "man")
945 format = detail::format_man{subcommands, version_check_dev_decision};
946 else if (arg == "ctd")
948 else if (arg == "cwl")
950 else
951 throw validation_error{"Validation failed for option --export-help: "
952 "Value must be one of "
953 + detail::supported_exports + "."};
954 }
955 else if (arg == "--version-check")
956 {
957 if (!read_next_arg())
958 throw too_few_arguments{"Option --version-check must be followed by a value."};
959
960 if (arg == "1" || arg == "true")
961 version_check_user_decision = true;
962 else if (arg == "0" || arg == "false")
963 version_check_user_decision = false;
964 else
965 throw validation_error{"Value for option --version-check must be true (1) or false (0)."};
966 }
967 else
968 {
969 // Flags, positional options, options using an alternative syntax (--optionValue, --option=value), etc.
970 format_arguments.emplace_back(arg);
971 }
972 }
973
974 // A special format was set. We do not need to parse the format_arguments.
976 return;
977
978 // All special options have been handled. If there are arguments left or we have a subparser,
979 // we call format_parse. Oterhwise, we print the short help (default variant).
980 if (!format_arguments.empty() || sub_parser)
981 format = detail::format_parse(format_arguments);
982 }
983
993 void verify_identifiers(char const short_id, std::string const & long_id)
994 {
995 auto is_valid = [](char const c) -> bool
996 {
997 return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') // alphanumeric
998 || c == '@' || c == '_' || c == '-'; // additional characters
999 };
1000
1001 if (short_id == '\0' && long_id.empty())
1002 throw design_error{"Short and long identifiers may not both be empty."};
1003
1004 if (short_id != '\0')
1005 {
1006 if (short_id == '-' || !is_valid(short_id))
1007 throw design_error{"Short identifiers may only contain alphanumeric characters, '_', or '@'."};
1008 if (detail::id_pair::contains(used_option_ids, short_id))
1009 throw design_error{"Short identifier '" + std::string(1, short_id) + "' was already used before."};
1010 }
1011
1012 if (!long_id.empty())
1013 {
1014 if (long_id.size() == 1)
1015 throw design_error{"Long identifiers must be either empty or longer than one character."};
1016 if (long_id[0] == '-')
1017 throw design_error{"Long identifiers may not use '-' as first character."};
1018 if (!std::ranges::all_of(long_id, is_valid))
1019 throw design_error{"Long identifiers may only contain alphanumeric characters, '_', '-', or '@'."};
1020 if (detail::id_pair::contains(used_option_ids, long_id))
1021 throw design_error{"Long identifier '" + long_id + "' was already used before."};
1022 }
1023
1024 used_option_ids.emplace(short_id, long_id);
1025 }
1026
1028 template <typename validator_t>
1030 {
1031 verify_identifiers(config.short_id, config.long_id);
1032
1033 if (config.short_id != '\0')
1034 options.emplace(std::string{"-"} + config.short_id);
1035 if (!config.long_id.empty())
1036 options.emplace(std::string{"--"} + config.long_id);
1037
1039 throw design_error{"A required option cannot have a default message."};
1040 }
1041
1043 template <typename validator_t>
1045 {
1046 verify_identifiers(config.short_id, config.long_id);
1047
1049 throw design_error{"A flag may not have a default message because the default is always `false`."};
1050 }
1051
1053 template <typename validator_t>
1055 {
1056 if (config.short_id != '\0' || config.long_id != "")
1057 throw design_error{"Positional options are identified by their position on the command line. "
1058 "Short or long ids are not permitted!"};
1059
1061 throw design_error{"Positional options are always required and therefore cannot be advanced nor hidden!"};
1062
1063 if (!subcommands.empty())
1064 throw design_error{"You may only specify flags and options for the top-level parser."};
1065
1066 if (has_positional_list_option)
1067 throw design_error{"You added a positional option with a list value before so you cannot add "
1068 "any other positional options."};
1069
1071 throw design_error{"A positional option may not have a default message because it is always required."};
1072 }
1073
1083 inline void check_parse_not_called(std::string_view const function_name) const
1084 {
1085 if (parse_was_called)
1086 throw design_error{detail::to_string(function_name.data(), " may only be used before calling parse().")};
1087 }
1088
1097 {
1098 // Before creating the detail::version_checker, we have to make sure that
1099 // malicious code cannot be injected through the app name.
1100 if (!std::regex_match(info.app_name, app_name_regex))
1101 {
1102 throw design_error{("The application name must only contain alpha-numeric characters or '_' and '-' "
1103 "(regex: \"^[a-zA-Z0-9_-]+$\").")};
1104 }
1105
1106 for (auto & sub : this->subcommands)
1107 {
1108 if (!std::regex_match(sub, app_name_regex))
1109 {
1110 throw design_error{"The subcommand name must only contain alpha-numeric characters or '_' and '-' "
1111 "(regex: \"^[a-zA-Z0-9_-]+$\")."};
1112 }
1113 }
1114 }
1115
1121 inline void run_version_check()
1122 {
1123 detail::version_checker app_version{info.app_name, info.version, info.url};
1124
1125 if (app_version.decide_if_check_is_performed(version_check_dev_decision, version_check_user_decision))
1126 {
1127 // must be done before calling parse on the format because this might std::exit
1128 std::promise<bool> app_version_prom;
1129 version_check_future = app_version_prom.get_future();
1130 app_version(std::move(app_version_prom));
1131 }
1132 }
1133
1144 inline void parse_format()
1145 {
1146 auto format_parse_fn = [this]<typename format_t>(format_t & f)
1147 {
1149 f.parse(info, executable_name);
1150 else
1151 f.parse(info);
1152 };
1153
1154 std::visit(std::move(format_parse_fn), format);
1155 }
1156};
1157
1158} // namespace sharg
T all_of(T... args)
T cbegin(T... args)
Parser exception that is thrown whenever there is an design error directed at the developer of the ap...
Definition exceptions.hpp:207
The format that prints the help page to std::cout.
Definition format_help.hpp:34
The format that prints the help page as html to std::cout.
Definition format_html.hpp:30
The format that prints the help page information formatted for a man page to std::cout.
Definition format_man.hpp:31
The format that organizes the actual parsing of command line arguments.
Definition format_parse.hpp:48
static iterator_type find_option_id(iterator_type begin_it, iterator_type end_it, detail::id_pair const &id)
Finds the position of a short/long identifier in format_parse::arguments.
Definition format_parse.hpp:164
The format that prints a short help message to std::cout.
Definition format_help.hpp:407
A generalized format to create different tool description files.
Definition format_tdl.hpp:106
@ CTD
Support for CTD format.
@ CWL
Support for CWL format.
The format that prints the version to std::cout.
Definition format_help.hpp:437
A functor whose operator() performs the server http request and version checks.
Definition version_check.hpp:55
The Sharg command line parser.
Definition parser.hpp:158
void verify_app_and_subcommand_names() const
Verifies that the app and subcommand names are correctly formatted.
Definition parser.hpp:1096
void verify_identifiers(char const short_id, std::string const &long_id)
Verifies that the short and the long identifiers are correctly formatted.
Definition parser.hpp:993
void add_option(option_type &value, config< validator_type > const &config)
Adds an option to the sharg::parser.
Definition parser.hpp:245
std::future< bool > version_check_future
The future object that keeps track of the detached version check call thread.
Definition parser.hpp:732
void add_flag(bool &value, config< validator_type > const &config)
Adds a flag to the sharg::parser.
Definition parser.hpp:278
parser(std::string app_name, std::vector< std::string > arguments, update_notifications version_updates=update_notifications::on, std::vector< std::string > const &subcommands={})
Initializes an sharg::parser object from the command line arguments.
Definition parser.hpp:185
parser()=delete
Deleted.
void parse_format()
Parses the command line arguments according to the format.
Definition parser.hpp:1144
parser(std::string app_name, int const argc, char const *const *const argv, update_notifications version_updates=update_notifications::on, std::vector< std::string > const &subcommands={})
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition parser.hpp:197
void add_subsection(std::string const &title, bool const advanced_only=false)
Adds an help page subsection to the sharg::parser.
Definition parser.hpp:559
bool is_option_set(id_type const &id) const
Checks whether the option identifier (id) was set on the command line by the user.
Definition parser.hpp:494
std::optional< bool > version_check_user_decision
Whether the user specified to perform the version check (true) or not (false), default unset.
Definition parser.hpp:726
void add_subcommands(std::vector< std::string > const &subcommands)
Adds subcommands to the parser.
Definition parser.hpp:652
void add_positional_option(option_type &value, config< validator_type > const &config)
Adds a positional option to the sharg::parser.
Definition parser.hpp:329
parser_meta_data info
Aggregates all parser related meta data (see sharg::parser_meta_data struct).
Definition parser.hpp:713
parser(parser &&)=default
Defaulted.
void parse()
Initiates the actual command line parsing.
Definition parser.hpp:418
parser & operator=(parser const &)=delete
Deleted.
parser(parser const &)=delete
Deleted.
void add_list_item(std::string const &key, std::string const &desc, bool const advanced_only=false)
Adds an help page list item (key-value) to the sharg::parser.
Definition parser.hpp:624
std::vector< std::function< void()> > operations
Vector of functions that stores all calls.
Definition parser.hpp:784
parser & operator=(parser &&)=default
Defaulted.
void check_parse_not_called(std::string_view const function_name) const
Throws a sharg::design_error if parse() was already called.
Definition parser.hpp:1083
void add_section(std::string const &title, bool const advanced_only=false)
Adds an help page section to the sharg::parser.
Definition parser.hpp:532
~parser()
The destructor.
Definition parser.hpp:206
std::vector< std::string > arguments
The original command line arguments.
Definition parser.hpp:775
void determine_format_and_subcommand()
Handles format and subcommand detection.
Definition parser.hpp:813
std::vector< std::string > subcommands
Stores the sub-parser names in case subcommand parsing is enabled.
Definition parser.hpp:744
parser & get_sub_parser()
Returns a reference to the sub-parser instance if subcommand parsing was enabled.
Definition parser.hpp:452
update_notifications version_check_dev_decision
Set on construction and indicates whether the developer deactivates the version check calls completel...
Definition parser.hpp:723
void verify_flag_config(config< validator_t > const &config)
brief Verify the configuration given to a sharg::parser::add_flag call.
Definition parser.hpp:1044
void add_line(std::string const &text, bool is_paragraph=false, bool const advanced_only=false)
Adds an help page text line to the sharg::parser.
Definition parser.hpp:587
void run_version_check()
Runs the version check if the user has not disabled it.
Definition parser.hpp:1121
void verify_option_config(config< validator_t > const &config)
brief Verify the configuration given to a sharg::parser::add_option call.
Definition parser.hpp:1029
void verify_positional_option_config(config< validator_t > const &config) const
brief Verify the configuration given to a sharg::parser::add_positional_option call.
Definition parser.hpp:1054
Parser exception thrown when too few arguments are provided.
Definition exceptions.hpp:100
Parser exception thrown when an incorrect argument is given as (positional) option value.
Definition exceptions.hpp:160
Parser exception thrown when an argument could not be casted to the according type.
Definition exceptions.hpp:180
Whether the option type is considered to be a container.
Definition detail/concept.hpp:38
Checks whether the the type can be used in an add_(positional_)option call on the parser.
Definition concept.hpp:91
Provides sharg::config class.
T data(T... args)
T empty(T... args)
T cend(T... args)
T exit(T... args)
T find(T... args)
Provides the format_help struct that print the help page to the command line and the two child format...
Provides the format_html struct and its helper functions.
Provides the format_man struct and its helper functions.
Provides the format_parse class.
Provides the format_tdl struct and its helper functions.
T get_future(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:27
@ off
Automatic update notifications should be disabled.
@ on
Automatic update notifications should be enabled.
T insert(T... args)
T is_same_v
T regex_match(T... args)
T replace(T... args)
T size(T... args)
T sort(T... args)
Option struct that is passed to the sharg::parser::add_option() function.
Definition config.hpp:43
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
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
A simple struct to store a short and a long identifier for an option.
Definition id_pair.hpp:25
static bool contains(std::unordered_set< id_pair > const &used_ids, id_type const &id)
Checks whether an id is already contained in a set of used ids.
Definition id_pair.hpp:161
static auto find(std::unordered_set< id_pair > const &used_ids, id_type const &id)
Finds an id_pair in a set of used ids.
Definition id_pair.hpp:148
Stores all parser related meta information of the sharg::parser.
Definition auxiliary.hpp:99
std::string email
The author's e-mail address for correspondence.
Definition auxiliary.hpp:117
std::string app_name
The application name that will be displayed on the help page.
Definition auxiliary.hpp:105
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition auxiliary.hpp:108
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition auxiliary.hpp:133
std::string url
A link to your github/gitlab project with the newest release.
Definition auxiliary.hpp:125
std::string short_copyright
Brief copyright (and/or license) information.
Definition auxiliary.hpp:128
std::string date
The date that the application was last updated. Keep this updated, ! since it will tell your users th...
Definition auxiliary.hpp:122
std::string author
Your name ;-)
Definition auxiliary.hpp:114
vector_of_string citation
How users shall cite your application.
Definition auxiliary.hpp:136
T unique(T... args)
Provides the version check functionality.
T visit(T... args)
Hide me