mirror of
https://github.com/CLIUtils/CLI11.git
synced 2026-01-19 04:52:08 +00:00
Ci build update (#1151)
update ci build images, remove ubuntu 20.04 and update a few others, fix some newer clang-tidy warnings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -46,7 +46,15 @@ namespace CLI {
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS_STYLE, SUBCOMMAND, SUBCOMMAND_TERMINATOR };
|
||||
enum class Classifier : std::uint8_t {
|
||||
NONE,
|
||||
POSITIONAL_MARK,
|
||||
SHORT,
|
||||
LONG,
|
||||
WINDOWS_STYLE,
|
||||
SUBCOMMAND,
|
||||
SUBCOMMAND_TERMINATOR
|
||||
};
|
||||
struct AppFriend;
|
||||
} // namespace detail
|
||||
|
||||
@@ -60,7 +68,7 @@ CLI11_INLINE std::string help(const App *app, const Error &e);
|
||||
|
||||
/// enumeration of modes of how to deal with extras in config files
|
||||
|
||||
enum class config_extras_mode : char { error = 0, ignore, ignore_all, capture };
|
||||
enum class config_extras_mode : std::uint8_t { error = 0, ignore, ignore_all, capture };
|
||||
|
||||
class App;
|
||||
|
||||
@@ -242,7 +250,7 @@ class App {
|
||||
/// specify that positional arguments come at the end of the argument sequence not inheritable
|
||||
bool positionals_at_end_{false};
|
||||
|
||||
enum class startup_mode : char { stable, enabled, disabled };
|
||||
enum class startup_mode : std::uint8_t { stable, enabled, disabled };
|
||||
/// specify the startup mode for the app
|
||||
/// stable=no change, enabled= startup enabled, disabled=startup disabled
|
||||
startup_mode default_startup{startup_mode::stable};
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CLI {
|
||||
|
||||
/// These codes are part of every error in CLI. They can be obtained from e using e.exit_code or as a quick shortcut,
|
||||
/// int values from e.get_error_code().
|
||||
enum class ExitCodes {
|
||||
enum class ExitCodes : int {
|
||||
Success = 0,
|
||||
IncorrectConstruction = 100,
|
||||
BadNameString,
|
||||
|
||||
@@ -29,7 +29,7 @@ class App;
|
||||
/// This is passed in by App; all user classes must accept this as
|
||||
/// the second argument.
|
||||
|
||||
enum class AppFormatMode {
|
||||
enum class AppFormatMode : std::uint8_t {
|
||||
Normal, ///< The normal, detailed help
|
||||
All, ///< A fully expanded help
|
||||
Sub, ///< Used when printed as part of expanded subcommand
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CLI {
|
||||
namespace detail {
|
||||
// Based generally on https://rmf.io/cxx11/almost-static-if
|
||||
/// Simple empty scoped class
|
||||
enum class enabler {};
|
||||
enum class enabler : std::uint8_t {};
|
||||
|
||||
/// An instance to use in EnableIf
|
||||
constexpr enabler dummy = {};
|
||||
@@ -628,7 +628,7 @@ struct expected_count<T, typename std::enable_if<!is_mutable_container<T>::value
|
||||
};
|
||||
|
||||
// Enumeration of the different supported categorizations of objects
|
||||
enum class object_category : int {
|
||||
enum class object_category : std::uint8_t {
|
||||
char_value = 1,
|
||||
integral_value = 2,
|
||||
unsigned_integral = 4,
|
||||
|
||||
@@ -185,7 +185,7 @@ class CustomValidator : public Validator {
|
||||
namespace detail {
|
||||
|
||||
/// CLI enumeration of different file types
|
||||
enum class path_type { nonexistent, file, directory };
|
||||
enum class path_type : std::uint8_t { nonexistent, file, directory };
|
||||
|
||||
/// get the type of the path from a file name
|
||||
CLI11_INLINE path_type check_path(const char *file) noexcept;
|
||||
@@ -356,6 +356,7 @@ template <
|
||||
typename T,
|
||||
enable_if_t<!is_copyable_ptr<typename std::remove_reference<T>::type>::value, detail::enabler> = detail::dummy>
|
||||
typename std::remove_reference<T>::type &smart_deref(T &value) {
|
||||
// NOLINTNEXTLINE
|
||||
return value;
|
||||
}
|
||||
/// Generate a string representation of a set
|
||||
@@ -721,7 +722,7 @@ class AsNumberWithUnit : public Validator {
|
||||
/// CASE_SENSITIVE/CASE_INSENSITIVE controls how units are matched.
|
||||
/// UNIT_OPTIONAL/UNIT_REQUIRED throws ValidationError
|
||||
/// if UNIT_REQUIRED is set and unit literal is not found.
|
||||
enum Options {
|
||||
enum Options : std::uint8_t {
|
||||
CASE_SENSITIVE = 0,
|
||||
CASE_INSENSITIVE = 1,
|
||||
UNIT_OPTIONAL = 0,
|
||||
|
||||
@@ -291,11 +291,11 @@ CLI11_INLINE std::string Formatter::make_option(const Option *opt, bool is_posit
|
||||
int shortNamesOverSize = 0;
|
||||
|
||||
// Print short names
|
||||
if(shortNames.length() > 0) {
|
||||
if(!shortNames.empty()) {
|
||||
shortNames = " " + shortNames; // Indent
|
||||
if(longNames.length() == 0 && opts.length() > 0)
|
||||
if(longNames.empty() && !opts.empty())
|
||||
shortNames += opts; // Add opts if only short names and no long names
|
||||
if(longNames.length() > 0)
|
||||
if(!longNames.empty())
|
||||
shortNames += ",";
|
||||
if(static_cast<int>(shortNames.length()) >= shortNamesColumnWidth) {
|
||||
shortNames += " ";
|
||||
@@ -312,8 +312,8 @@ CLI11_INLINE std::string Formatter::make_option(const Option *opt, bool is_posit
|
||||
const auto adjustedLongNamesColumnWidth = longNamesColumnWidth - shortNamesOverSize;
|
||||
|
||||
// Print long names
|
||||
if(longNames.length() > 0) {
|
||||
if(opts.length() > 0)
|
||||
if(!longNames.empty()) {
|
||||
if(!opts.empty())
|
||||
longNames += opts;
|
||||
if(static_cast<int>(longNames.length()) >= adjustedLongNamesColumnWidth)
|
||||
longNames += " ";
|
||||
|
||||
@@ -109,7 +109,7 @@ get_names(const std::vector<std::string> &input, bool allow_non_standard) {
|
||||
std::vector<std::string> long_names;
|
||||
std::string pos_name;
|
||||
for(std::string name : input) {
|
||||
if(name.length() == 0) {
|
||||
if(name.empty()) {
|
||||
continue;
|
||||
}
|
||||
if(name.length() > 1 && name[0] == '-' && name[1] != '-') {
|
||||
|
||||
Reference in New Issue
Block a user