Skip to content

Commit

Permalink
style: pre-commit.ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 11, 2023
1 parent 22c7e8d commit 709c5c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions include/CLI/StringTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ CLI11_INLINE std::ostream &format_aliases(std::ostream &out, const std::vector<s
/// Verify the first character of an option
/// - is a trigger character, ! has special meaning and new lines would just be annoying to deal with
template <typename T> bool valid_first_char(T c) {
return ((c != '-') && (static_cast<unsigned char>(c) > 33)); // space and '!' not allowed
return ((c != '-') && (static_cast<unsigned char>(c) > 33)); // space and '!' not allowed
}

/// Verify following characters of an option
template <typename T> bool valid_later_char(T c) {
// = and : are value separators, { has special meaning for option defaults,
// and control codes other than tab would just be annoying to deal with in many places allowing space here has too much potential for
// inadvertent entry errors and bugs
return ((c != '=') && (c != ':') && (c != '{') && ((static_cast<unsigned char>(c) > 32)||c=='\t'));
// and control codes other than tab would just be annoying to deal with in many places allowing space here has too
// much potential for inadvertent entry errors and bugs
return ((c != '=') && (c != ':') && (c != '{') && ((static_cast<unsigned char>(c) > 32) || c == '\t'));
}

/// Verify an option/subcommand name
Expand Down
3 changes: 2 additions & 1 deletion include/CLI/impl/App_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ CLI11_INLINE bool App::remove_option(Option *opt) {
CLI11_INLINE App *App::add_subcommand(std::string subcommand_name, std::string subcommand_description) {
if(!subcommand_name.empty() && !detail::valid_name_string(subcommand_name)) {
if(!detail::valid_first_char(subcommand_name[0])) {
throw IncorrectConstruction("Subcommand name starts with invalid character, '!' and '-' and control characters");
throw IncorrectConstruction(
"Subcommand name starts with invalid character, '!' and '-' and control characters");
}
for(auto c : subcommand_name) {
if(!detail::valid_later_char(c)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fuzzFail/fuzz_app_file_fail9
Original file line number Diff line number Diff line change
@@ -1 +1 @@
=o����������p--2v��t ' �-�-
=o����������p--2v��t ' �-�-

0 comments on commit 709c5c6

Please sign in to comment.