summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorJF Bastien <github@jfbastien.com>2016-01-20 15:05:29 -0800
committerJF Bastien <github@jfbastien.com>2016-01-20 15:05:29 -0800
commitf032a4a7b14fc8c60b1a07d44c38fdff573b3baa (patch)
treedf4b4e8b95a052e78e9d7d5cc8d239e21a5bcfcc /src/support
parent9f52fd46b6c6c961c8eeb9891e2a5c4f36fe09b2 (diff)
downloadbinaryen-f032a4a7b14fc8c60b1a07d44c38fdff573b3baa.tar.gz
binaryen-f032a4a7b14fc8c60b1a07d44c38fdff573b3baa.tar.bz2
binaryen-f032a4a7b14fc8c60b1a07d44c38fdff573b3baa.zip
Fix command-line help when there's only long or short
Diffstat (limited to 'src/support')
-rw-r--r--src/support/command-line.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp
index c078ef45f..b4f8a4d62 100644
--- a/src/support/command-line.cpp
+++ b/src/support/command-line.cpp
@@ -32,9 +32,11 @@ Options::Options(const std::string &command, const std::string &description)
}
// TODO: line-wrap description.
for (const auto &o : options) {
+ bool long_n_short = o.longName.size() != 0 && o.shortName.size() != 0;
size_t pad = 1 + optionWidth - o.longName.size() - o.shortName.size();
- std::cerr << " " << o.longName << ',' << o.shortName
- << std::string(pad, ' ') << o.description << '\n';
+ std::cerr << " " << o.longName << (long_n_short ? ',' : ' ')
+ << o.shortName << std::string(pad, ' ') << o.description
+ << '\n';
}
std::cerr << '\n';
exit(EXIT_SUCCESS);