Skip to content

Commit

Permalink
do not show nargs range if just one args
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Feb 2, 2024
1 parent bd9acc4 commit b2bfdaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion inst/include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,8 @@ class Argument {
if (range.m_max == (std::numeric_limits<std::size_t>::max)()) {
stream << "[nargs: " << range.m_min << " or more] ";
} else {
stream << "[nargs=" << range.m_min << ".." << range.m_max << "] ";
if (!(range.m_min == 0 && range.m_max == 1))
stream << "[nargs=" << range.m_min << ".." << range.m_max << "] ";
}
}
return stream;
Expand Down
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ int main(int argc, char * argv[])
.scan<'g', double>();
program.add_argument("-q","--NQ")
.help("disable updating Q")
.default_value(false)
.implicit_value(true);
.flag();
program.add_argument("-p", "--NP")
.help("disable updating P")
.default_value(false)
.implicit_value(true);
.flag();
program.add_argument("-r", "--NR")
.help("disable updating R")
.flag();
Expand Down

0 comments on commit b2bfdaf

Please sign in to comment.