mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
parent
2c1711ae33
commit
d04e1ff12a
1 changed files with 12 additions and 4 deletions
|
@ -265,15 +265,18 @@ static void printTree(const Path & path,
|
|||
/* Perform various sorts of queries. */
|
||||
static void opQuery(Strings opFlags, Strings opArgs)
|
||||
{
|
||||
enum { qOutputs, qRequisites, qReferences, qReferrers
|
||||
enum QueryType
|
||||
{ qDefault, qOutputs, qRequisites, qReferences, qReferrers
|
||||
, qReferrersClosure, qDeriver, qBinding, qHash, qSize
|
||||
, qTree, qGraph, qXml, qResolve, qRoots } query = qOutputs;
|
||||
, qTree, qGraph, qXml, qResolve, qRoots };
|
||||
QueryType query = qDefault;
|
||||
bool useOutput = false;
|
||||
bool includeOutputs = false;
|
||||
bool forceRealise = false;
|
||||
string bindingName;
|
||||
|
||||
foreach (Strings::iterator, i, opFlags)
|
||||
foreach (Strings::iterator, i, opFlags) {
|
||||
QueryType prev = query;
|
||||
if (*i == "--outputs") query = qOutputs;
|
||||
else if (*i == "--requisites" || *i == "-R") query = qRequisites;
|
||||
else if (*i == "--references") query = qReferences;
|
||||
|
@ -298,6 +301,11 @@ static void opQuery(Strings opFlags, Strings opArgs)
|
|||
else if (*i == "--force-realise" || *i == "--force-realize" || *i == "-f") forceRealise = true;
|
||||
else if (*i == "--include-outputs") includeOutputs = true;
|
||||
else throw UsageError(format("unknown flag ‘%1%’") % *i);
|
||||
if (prev != qDefault && prev != query)
|
||||
throw UsageError(format("query type ‘%1%’ conflicts with earlier flag") % *i);
|
||||
}
|
||||
|
||||
if (query == qDefault) query = qOutputs;
|
||||
|
||||
RunPager pager;
|
||||
|
||||
|
|
Loading…
Reference in a new issue