mirror of
https://github.com/NixOS/nix
synced 2025-07-01 08:28:00 +02:00
Add "nix search" command
This commit is contained in:
parent
3162ad5ff4
commit
90825dea51
9 changed files with 263 additions and 102 deletions
|
@ -66,6 +66,7 @@ void Args::printHelp(const string & programName, std::ostream & out)
|
|||
std::cout << renderLabels({exp.label});
|
||||
// FIXME: handle arity > 1
|
||||
if (exp.arity == 0) std::cout << "...";
|
||||
if (exp.optional) std::cout << "?";
|
||||
}
|
||||
std::cout << "\n";
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ public:
|
|||
}
|
||||
|
||||
/* Expect a string argument. */
|
||||
void expectArg(const std::string & label, string * dest)
|
||||
void expectArg(const std::string & label, string * dest, bool optional = false)
|
||||
{
|
||||
expectedArgs.push_back(ExpectedArg{label, 1, false, [=](Strings ss) {
|
||||
expectedArgs.push_back(ExpectedArg{label, 1, optional, [=](Strings ss) {
|
||||
*dest = ss.front();
|
||||
}});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue