forked from lix-project/lix
parent
2c1711ae33
commit
d04e1ff12a
|
@ -265,15 +265,18 @@ static void printTree(const Path & path,
|
||||||
/* Perform various sorts of queries. */
|
/* Perform various sorts of queries. */
|
||||||
static void opQuery(Strings opFlags, Strings opArgs)
|
static void opQuery(Strings opFlags, Strings opArgs)
|
||||||
{
|
{
|
||||||
enum { qOutputs, qRequisites, qReferences, qReferrers
|
enum QueryType
|
||||||
, qReferrersClosure, qDeriver, qBinding, qHash, qSize
|
{ qDefault, qOutputs, qRequisites, qReferences, qReferrers
|
||||||
, qTree, qGraph, qXml, qResolve, qRoots } query = qOutputs;
|
, qReferrersClosure, qDeriver, qBinding, qHash, qSize
|
||||||
|
, qTree, qGraph, qXml, qResolve, qRoots };
|
||||||
|
QueryType query = qDefault;
|
||||||
bool useOutput = false;
|
bool useOutput = false;
|
||||||
bool includeOutputs = false;
|
bool includeOutputs = false;
|
||||||
bool forceRealise = false;
|
bool forceRealise = false;
|
||||||
string bindingName;
|
string bindingName;
|
||||||
|
|
||||||
foreach (Strings::iterator, i, opFlags)
|
foreach (Strings::iterator, i, opFlags) {
|
||||||
|
QueryType prev = query;
|
||||||
if (*i == "--outputs") query = qOutputs;
|
if (*i == "--outputs") query = qOutputs;
|
||||||
else if (*i == "--requisites" || *i == "-R") query = qRequisites;
|
else if (*i == "--requisites" || *i == "-R") query = qRequisites;
|
||||||
else if (*i == "--references") query = qReferences;
|
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 == "--force-realise" || *i == "--force-realize" || *i == "-f") forceRealise = true;
|
||||||
else if (*i == "--include-outputs") includeOutputs = true;
|
else if (*i == "--include-outputs") includeOutputs = true;
|
||||||
else throw UsageError(format("unknown flag ‘%1%’") % *i);
|
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;
|
RunPager pager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue