1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 05:03:52 +00:00

Allowing comma sep. options everywhere

This commit is contained in:
Henry Fredrick Schreiner 2017-02-04 08:41:21 -05:00
parent 9dea0cf2e9
commit 8b224fa7a9

View File

@ -844,6 +844,18 @@ public:
}
template<typename T, typename... Args>
Option* add_set(
std::string name, ///< The name, short,long
T &member, ///< The selected member of the set
std::set<T> options, ///< The set of posibilities
std::string discription, ///< Discription string
detail::Combiner opts, ///< The options (REQUIRED, DEFAULT, POSITIONAL, ARGS())
detail::Combiner opts2,
Args... args
) {
return add_set(name, member, options, discription, opts|opts2, args...);
}
//------------ MAKE STYLE ---------//
@ -878,6 +890,17 @@ public:
return out;
}
template<typename T = std::string, typename... Args>
Value<T> make_option(
std::string name, ///< The name, short,long
std::string discription,
detail::Combiner opts,
detail::Combiner opts2,
Args... args
) {
return make_option(name, discription, opts|opts2, args...);
}
/// Prototype for new output style with default
template<typename T,
enable_if_t<!is_vector<T>::value, detail::enabler> = detail::dummy>
@ -944,6 +967,18 @@ public:
}
template<typename T, typename... Args>
Value<T> make_option(
std::string name, ///< The name, short,long
const T& default_value,
std::string discription,
detail::Combiner opts,
detail::Combiner opts2,
Args... args
) {
return make_option(name, default_value, discription, opts|opts2, args...);
}
/// Prototype for new output style: flag
Value<int> make_flag(
std::string name, ///< The name, short,long
@ -999,6 +1034,17 @@ public:
}
template<typename T, typename... Args>
Value<T> make_set(
std::string name,
std::set<T> options,
std::string discription,
detail::Combiner opts,
detail::Combiner opts2,
Args... args
) {
return make_set(name, options, discription, opts|opts2, args...);
}
/// Parses the command line - throws errors
void parse(int argc, char **argv) {