diff options
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r-- | src/nix/main.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc index ec9b58b20..060402cd0 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -20,19 +20,29 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs { NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix") { - mkFlag('h', "help", "show usage information", [&]() { showHelpAndExit(); }); - - 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)); + mkFlag() + .longName("help") + .shortName('h') + .description("show usage information") + .handler([&]() { showHelpAndExit(); }); + + mkFlag() + .longName("help-config") + .description("show configuration options") + .handler([&]() { + 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() + .longName("version") + .description("show version information") + .handler([&]() { printVersion(programName); }); std::string cat = "config"; settings.convertToArgs(*this, cat); |