Skip to content

Commit 4e55c79

Browse files
authored
Merge pull request #2247 from joto/contrib-cli11
Update included CLI11 library to version 2.4.2
2 parents fa5b152 + f4eedc5 commit 4e55c79

29 files changed

+175
-84
lines changed

contrib/CLI11/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CLI11 2.2 Copyright (c) 2017-2023 University of Cincinnati, developed by Henry
1+
CLI11 2.2 Copyright (c) 2017-2024 University of Cincinnati, developed by Henry
22
Schreiner under NSF AWARD 1414736. All rights reserved.
33

44
Redistribution and use in source and binary forms of CLI11, with or without

contrib/CLI11/README.contrib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Source: https://github.com/CLIUtils/CLI11
2-
Revision: v2.4.1
2+
Revision: v2.4.2

contrib/CLI11/README.md

Lines changed: 26 additions & 19 deletions
Large diffs are not rendered by default.

contrib/CLI11/include/CLI/App.hpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#pragma once
88

9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
911
// [CLI11:public_includes:set]
1012
#include <algorithm>
1113
#include <cstdint>
@@ -733,6 +735,10 @@ class App {
733735
/// Check to see if a subcommand is part of this command (text version)
734736
CLI11_NODISCARD App *get_subcommand(std::string subcom) const;
735737

738+
/// Get a subcommand by name (noexcept non-const version)
739+
/// returns null if subcommand doesn't exist
740+
CLI11_NODISCARD App *get_subcommand_no_throw(std::string subcom) const noexcept;
741+
736742
/// Get a pointer to subcommand by index
737743
CLI11_NODISCARD App *get_subcommand(int index = 0) const;
738744

@@ -907,8 +913,9 @@ class App {
907913
}
908914

909915
/// Check with name instead of pointer to see if subcommand was selected
910-
CLI11_NODISCARD bool got_subcommand(std::string subcommand_name) const {
911-
return get_subcommand(subcommand_name)->parsed_ > 0;
916+
CLI11_NODISCARD bool got_subcommand(std::string subcommand_name) const noexcept {
917+
App *sub = get_subcommand_no_throw(subcommand_name);
918+
return (sub != nullptr) ? (sub->parsed_ > 0) : false;
912919
}
913920

914921
/// Sets excluded options for the subcommand
@@ -1038,7 +1045,7 @@ class App {
10381045
std::vector<Option *> get_options(const std::function<bool(Option *)> filter = {});
10391046

10401047
/// Get an option by name (noexcept non-const version)
1041-
Option *get_option_no_throw(std::string option_name) noexcept;
1048+
CLI11_NODISCARD Option *get_option_no_throw(std::string option_name) noexcept;
10421049

10431050
/// Get an option by name (noexcept const version)
10441051
CLI11_NODISCARD const Option *get_option_no_throw(std::string option_name) const noexcept;
@@ -1437,5 +1444,5 @@ struct AppFriend {
14371444
} // namespace CLI
14381445

14391446
#ifndef CLI11_COMPILE
1440-
#include "impl/App_inl.hpp"
1447+
#include "impl/App_inl.hpp" // IWYU pragma: export
14411448
#endif

contrib/CLI11/include/CLI/Argv.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
#pragma once
88

9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
911
// [CLI11:public_includes:set]
1012
#include <string>
1113
#include <vector>
1214
// [CLI11:public_includes:end]
1315

14-
#include <CLI/Macros.hpp>
16+
#include "Macros.hpp"
1517

1618
namespace CLI {
1719
// [CLI11:argv_hpp:verbatim]
@@ -25,5 +27,5 @@ CLI11_INLINE std::vector<std::string> compute_win32_argv();
2527
} // namespace CLI
2628

2729
#ifndef CLI11_COMPILE
28-
#include "impl/Argv_inl.hpp"
30+
#include "impl/Argv_inl.hpp" // IWYU pragma: export
2931
#endif

contrib/CLI11/include/CLI/CLI.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// CLI Library includes
1010
// Order is important for combiner script
1111

12+
// IWYU pragma: begin_exports
13+
1214
#include "Version.hpp"
1315

1416
#include "Macros.hpp"
@@ -38,3 +40,5 @@
3840
#include "Config.hpp"
3941

4042
#include "Formatter.hpp"
43+
44+
// IWYU pragma: end_exports

contrib/CLI11/include/CLI/Config.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#pragma once
88

9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
911
// [CLI11:public_includes:set]
1012
#include <algorithm>
1113
#include <cctype>
@@ -49,5 +51,5 @@ void checkParentSegments(std::vector<ConfigItem> &output, const std::string &cur
4951
} // namespace CLI
5052

5153
#ifndef CLI11_COMPILE
52-
#include "impl/Config_inl.hpp"
54+
#include "impl/Config_inl.hpp" // IWYU pragma: export
5355
#endif

contrib/CLI11/include/CLI/ConfigFwd.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#pragma once
88

9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
911
// [CLI11:public_includes:set]
1012
#include <algorithm>
1113
#include <fstream>

contrib/CLI11/include/CLI/Encoding.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
#pragma once
88

9-
#include <CLI/Macros.hpp>
9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
#include "Macros.hpp"
1011

1112
// [CLI11:public_includes:set]
1213
#include <string>
@@ -50,5 +51,5 @@ CLI11_INLINE std::filesystem::path to_path(std::string_view str);
5051
} // namespace CLI
5152

5253
#ifndef CLI11_COMPILE
53-
#include "impl/Encoding_inl.hpp"
54+
#include "impl/Encoding_inl.hpp" // IWYU pragma: export
5455
#endif

contrib/CLI11/include/CLI/Error.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#pragma once
88

9+
// IWYU pragma: private, include "CLI/CLI.hpp"
10+
911
// [CLI11:public_includes:set]
1012
#include <exception>
1113
#include <stdexcept>
@@ -237,22 +239,22 @@ class RequiredError : public ParseError {
237239
if((min_option == 1) && (max_option == 1) && (used == 0))
238240
return RequiredError("Exactly 1 option from [" + option_list + "]");
239241
if((min_option == 1) && (max_option == 1) && (used > 1)) {
240-
return {"Exactly 1 option from [" + option_list + "] is required and " + std::to_string(used) +
242+
return {"Exactly 1 option from [" + option_list + "] is required but " + std::to_string(used) +
241243
" were given",
242244
ExitCodes::RequiredError};
243245
}
244246
if((min_option == 1) && (used == 0))
245247
return RequiredError("At least 1 option from [" + option_list + "]");
246248
if(used < min_option) {
247-
return {"Requires at least " + std::to_string(min_option) + " options used and only " +
248-
std::to_string(used) + "were given from [" + option_list + "]",
249+
return {"Requires at least " + std::to_string(min_option) + " options used but only " +
250+
std::to_string(used) + " were given from [" + option_list + "]",
249251
ExitCodes::RequiredError};
250252
}
251253
if(max_option == 1)
252254
return {"Requires at most 1 options be given from [" + option_list + "]", ExitCodes::RequiredError};
253255

254-
return {"Requires at most " + std::to_string(max_option) + " options be used and " + std::to_string(used) +
255-
"were given from [" + option_list + "]",
256+
return {"Requires at most " + std::to_string(max_option) + " options be used but " + std::to_string(used) +
257+
" were given from [" + option_list + "]",
256258
ExitCodes::RequiredError};
257259
}
258260
};

0 commit comments

Comments
 (0)