about summary refs log tree commit diff
path: root/src/libutil/args.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-21T12·34+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-21T12·34+0200
commit1b0088ebb226ab80c91b54c201cc70204b976310 (patch)
tree52f851fa6e91512a6e4351f104c4cfa7673957c6 /src/libutil/args.cc
parentddea253ff8312bf1d2559999c4dd8d9cc3e5b240 (diff)
nix --help: Show short flags
Diffstat (limited to 'src/libutil/args.cc')
-rw-r--r--src/libutil/args.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 6e4b82a279ce..115484f9e6c7 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -71,10 +71,11 @@ void Args::printHelp(const string & programName, std::ostream & out)
 void Args::printFlags(std::ostream & out)
 {
     Table2 table;
-    for (auto & flags : longFlags)
+    for (auto & flag : longFlags)
         table.push_back(std::make_pair(
-                "--" + flags.first + renderLabels(flags.second.labels),
-                flags.second.description));
+                (flag.second.shortName ? std::string("-") + flag.second.shortName + ", " : "    ")
+                + "--" + flag.first + renderLabels(flag.second.labels),
+                flag.second.description));
     printTable(out, table);
 }