mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +00:00
AK: Explicitly calculate length of char* when printing
This moves out the calculation of the char* out to the formatter. Additionally, we now print (null) when a null pointer is passed.
This commit is contained in:
parent
52d017c611
commit
6eecc65787
2 changed files with 9 additions and 2 deletions
|
@ -275,8 +275,12 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0)
|
|||
for (auto& opt : m_options) {
|
||||
if (opt.hide_mode != OptionHideMode::None)
|
||||
continue;
|
||||
|
||||
// FIXME: We allow opt.value_name to be empty even if the option
|
||||
// requires an argument. This should be disallowed as it will
|
||||
// currently display a blank name after the option.
|
||||
if (opt.requires_argument)
|
||||
out(file, " [{} {}]", opt.name_for_display(), opt.value_name);
|
||||
out(file, " [{} {}]", opt.name_for_display(), opt.value_name ?: "");
|
||||
else
|
||||
out(file, " [{}]", opt.name_for_display());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue