Skip to content

Commit

Permalink
Fixed empty default options being printed
Browse files Browse the repository at this point in the history
Before "default:" would always be printed in the help menu.

E.g. the input option from the readme example would become:
-i, --input    the input file, default: 
instead of:
-i, --input    the input file
  • Loading branch information
mtygesen authored Mar 24, 2024
1 parent 3ddc1b5 commit a1bda6d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/argz/argz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ namespace argz
else {
std::cout << (ids.id.size() == 1 ? "-" : "--") << ids.id;
}
std::cout << " " << h << ", default: " << detail::to_string(v) << '\n';

std::cout << " " << h;
detail::to_string(v).empty() ? std::cout << '\n' : std::cout << ", default: " << detail::to_string(v) << '\n';
}
std::cout << '\n';
}
Expand Down

0 comments on commit a1bda6d

Please sign in to comment.