nix: Respect -I, --arg, --argstr
Also, random cleanup to argument handling.
This commit is contained in:
parent
25f32625e2
commit
0d59f1ca49
26 changed files with 349 additions and 299 deletions
|
|
@ -20,19 +20,29 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
|
|||
{
|
||||
NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix")
|
||||
{
|
||||
mkFlag('h', "help", "show usage information", [&]() { showHelpAndExit(); });
|
||||
mkFlag()
|
||||
.longName("help")
|
||||
.shortName('h')
|
||||
.description("show usage information")
|
||||
.handler([&]() { 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()
|
||||
.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(0, "version", "show version information", std::bind(printVersion, programName));
|
||||
mkFlag()
|
||||
.longName("version")
|
||||
.description("show version information")
|
||||
.handler([&]() { printVersion(programName); });
|
||||
|
||||
std::string cat = "config";
|
||||
settings.convertToArgs(*this, cat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue