diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07 16:49:54 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07 16:49:54 +0200 |
commit | aa952d5f0bc623a1584f2d589209f586e594c75f (patch) | |
tree | 685780bc5155600f5f27f04c09302e2644236cad /src/nix/main.cc | |
parent | b8283773bd64d7da6859ed520ee19867742a03ba (diff) |
nix: Add --help-config flag
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r-- | src/nix/main.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc index f83843415..ea6838cd7 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -21,10 +21,30 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs throw Exit(); }); + mkFlag(0, "help-config", "show configuration options", [=]() { + std::cout << "The following configuration options are available:\n\n"; + Table2 tbl; + for (const auto & s : settings._getSettings()) + if (!s.second.isAlias) + tbl.emplace_back(s.first, s.second.setting->description); + printTable(std::cout, tbl); + throw Exit(); + }); + mkFlag(0, "version", "show version information", std::bind(printVersion, programName)); settings.convertToArgs(*this); } + + void printFlags(std::ostream & out) override + { + Args::printFlags(out); + std::cout << + "\n" + "In addition, most configuration settings can be overriden using ‘--<name> <value>’.\n" + "Boolean settings can be overriden using ‘--<name>’ or ‘--no-<name>’. See ‘nix\n" + "--help-config’ for a list of configuration settings.\n"; + } }; void mainWrapped(int argc, char * * argv) |