aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-08-23 11:49:16 -0400
committerDeterminant <[email protected]>2018-08-23 11:49:16 -0400
commitd2c471c2300141529983be425f7ad75d371fcdf7 (patch)
treefe3336f9992ec1d2f81cf38deecd46bef436223e /src
parent2cc3eb4fbb4ba50f08f4041f91e445c45306af66 (diff)
prettify help info
Diffstat (limited to 'src')
-rw-r--r--src/util.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 7ef01a9..07849fc 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -251,9 +251,13 @@ size_t Config::parse(int argc, char **argv) {
}
void Config::print_help(FILE *output) {
+ int width = 0;
+ for (const auto &opt: opts)
+ width = std::max(width, (int)opt->optname.length());
for (const auto &opt: opts)
{
- fprintf(output, "--%s\t\t", opt->optname.c_str());
+ fprintf(output, " --%s%*c", opt->optname.c_str(),
+ width - (int)opt->optname.length() + 4, ' ');
if (opt->short_opt != -1)
fprintf(output, "-%c\t", opt->short_opt);
else