28 const std::string_view arg_name,
const std::string_view reason
31 std::format(
"Given name [{}] is invalid.\nReason: {}", arg_name, reason)
45 static parsing_failure unknown_argument(
const std::string_view arg_name)
noexcept {
46 return parsing_failure(std::format(
"Unknown argument [{}].", arg_name));
51 std::format(
"Value for argument [{}] has already been set.", arg_name.str())
59 std::format(
"Cannot parse value `{}` for argument [{}].", value, arg_name.str())
67 "Value `{}` is not a valid choice for argument [{}].", value, arg_name.str()
74 std::format(
"No values parsed for a required argument [{}]", arg_name.str())
78 static parsing_failure argument_deduction_failure(
const std::vector<std::string_view>& values
81 std::format(
"Failed to deduce the argument for values [{}]", detail::join(values))
88 if (std::is_lt(ordering))
90 std::format(
"Not enough values provided for optional argument [{}]", arg_name.str())
93 if (std::is_gt(ordering))
95 std::format(
"Too many values provided for optional argument [{}]", arg_name.str())
99 std::format(
"Invalid number of values provided for argument [{}]", arg_name.str())
113 "Invalid value type specified for argument [{}] = {}.",
124 static lookup_failure argument_not_found(
const std::string_view& arg_name)
noexcept {
125 return lookup_failure(std::format(
"Argument with given name [{}] not found.", arg_name));
Provides common string utility functions.
Base type for the argument parser functionality errors/exceptions.
argument_parser_exception(const std::string &message)
Structure holding the argument's name.
std::string str(const std::optional< char > flag_char=std::nullopt) const noexcept
Get a string representation of the argument_name.
Exception type used for invalid configuration of an argument parser or its arguments.
Exception type used for element lookup errors.
Exception type used for errors encountered during the argument parsing operation.
Exception type used for type-related errors.