1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibCore: Don't print optional arguments in ArgsParser help messages

This fixes a misconception in our current `ArgsParser` implementation.
If `requires_argument` is false, it doesn't mean that the argument is
optional (i.e. "not required"). It means that there is no argument at
all.
This commit is contained in:
Tim Schumacher 2022-07-12 22:19:52 +02:00 committed by Linus Groh
parent 400ef9913e
commit 810b9daa63

View file

@ -235,8 +235,6 @@ void ArgsParser::print_usage_terminal(FILE* file, char const* argv0)
if (opt.value_name) {
if (opt.requires_argument)
out(file, " {}", opt.value_name);
else
out(file, " [{}]", opt.value_name);
}
};
out(file, "\t");
@ -324,8 +322,6 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0)
if (opt.value_name != nullptr) {
if (opt.requires_argument)
out(file, " {}", opt.value_name);
else
out(file, " [{}]", opt.value_name);
}
};
out(file, "* ");