|
|
@@ -43,11 +43,11 @@ namespace program {
|
|
|
|
|
|
template <typename Impl>
|
|
|
template <typename T>
|
|
|
-Arguments<Impl>::Positional::operator T() const {
|
|
|
+Arguments<Impl>::Argument::operator T() const {
|
|
|
return (*this) ? convert<T>(self->arguments.at(index)) : T();
|
|
|
}
|
|
|
|
|
|
-template <typename Impl> Arguments<Impl>::Positional::operator bool() const {
|
|
|
+template <typename Impl> Arguments<Impl>::Argument::operator bool() const {
|
|
|
bool const good = primed();
|
|
|
if (good && self->arguments.size() <= index) {
|
|
|
throw IllegalPositionError("No argument provided", index);
|
|
|
@@ -57,12 +57,12 @@ template <typename Impl> Arguments<Impl>::Positional::operator bool() const {
|
|
|
|
|
|
template <typename Impl>
|
|
|
template <typename T>
|
|
|
-auto Arguments<Impl>::Positional::operator=(T && value) {
|
|
|
+auto Arguments<Impl>::Argument::operator=(T && value) {
|
|
|
is_optional = true;
|
|
|
- return WithDefault<Positional, T>{*this, std::forward<T>(value)};
|
|
|
+ return WithDefault<Argument, T>{*this, std::forward<T>(value)};
|
|
|
}
|
|
|
|
|
|
-template <typename Impl> bool Arguments<Impl>::Positional::primed() const {
|
|
|
+template <typename Impl> bool Arguments<Impl>::Argument::primed() const {
|
|
|
if (self->primed_) { return true; }
|
|
|
if (is_optional) {
|
|
|
self->optional_from = std::min(self->optional_from, index);
|
|
|
@@ -72,7 +72,7 @@ template <typename Impl> bool Arguments<Impl>::Positional::primed() const {
|
|
|
if (!self->argument_names.emplace(index, name).second) {
|
|
|
throw IllegalPositionError("Duplicate positional", index);
|
|
|
}
|
|
|
- self->positional_descriptions.emplace(name, description);
|
|
|
+ self->argument_descriptions.emplace(name, description);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -116,8 +116,8 @@ template <typename Impl> void Arguments<Impl>::usage() const {
|
|
|
std::cout << " " << (index == optional_from ? "[" : "") << name;
|
|
|
}
|
|
|
if (optional_from != std::numeric_limits<size_t>::max()) { std::cout << "]"; }
|
|
|
- std::cout << "\nPositional Arguments:\n";
|
|
|
- for (auto & [name, desc] : positional_descriptions) {
|
|
|
+ std::cout << "\nArgument Arguments:\n";
|
|
|
+ for (auto & [name, desc] : argument_descriptions) {
|
|
|
std::cout << " " << name << ": " << desc << "\n";
|
|
|
}
|
|
|
std::cout << "Options:\n";
|
|
|
@@ -141,7 +141,7 @@ auto Arguments<Impl>::option(std::string const & name, char abbrev,
|
|
|
template <typename Impl>
|
|
|
auto Arguments<Impl>::argument(size_t index, std::string const & name,
|
|
|
std::string const & description) {
|
|
|
- return Positional{this, index, false, name, description};
|
|
|
+ return Argument{this, index, false, name, description};
|
|
|
}
|
|
|
|
|
|
}
|