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
|
|
@ -24,11 +24,11 @@ void Command::printHelp(const string & programName, std::ostream & out)
|
|||
MultiCommand::MultiCommand(const Commands & _commands)
|
||||
: commands(_commands)
|
||||
{
|
||||
expectedArgs.push_back(ExpectedArg{"command", 1, true, [=](Strings ss) {
|
||||
expectedArgs.push_back(ExpectedArg{"command", 1, true, [=](std::vector<std::string> ss) {
|
||||
assert(!command);
|
||||
auto i = commands.find(ss.front());
|
||||
auto i = commands.find(ss[0]);
|
||||
if (i == commands.end())
|
||||
throw UsageError(format("'%1%' is not a recognised command") % ss.front());
|
||||
throw UsageError("'%s' is not a recognised command", ss[0]);
|
||||
command = i->second;
|
||||
}});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue