diff options
author | Determinant <[email protected]> | 2018-08-23 11:49:16 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-08-23 11:49:16 -0400 |
commit | d2c471c2300141529983be425f7ad75d371fcdf7 (patch) | |
tree | fe3336f9992ec1d2f81cf38deecd46bef436223e | |
parent | 2cc3eb4fbb4ba50f08f4041f91e445c45306af66 (diff) |
prettify help info
-rw-r--r-- | src/util.cpp | 6 |
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 |