Style fix
This commit is contained in:
parent
858b8f9760
commit
e477f0e938
|
@ -14,12 +14,6 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
enum OutputKind {
|
|
||||||
OUTPUT_PLAIN,
|
|
||||||
OUTPUT_XML,
|
|
||||||
OUTPUT_JSON,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
|
||||||
|
@ -42,6 +36,9 @@ static int rootNr = 0;
|
||||||
static bool indirectRoot = false;
|
static bool indirectRoot = false;
|
||||||
|
|
||||||
|
|
||||||
|
enum OutputKind { okPlain, okXML, okJSON };
|
||||||
|
|
||||||
|
|
||||||
void processExpr(EvalState & state, const Strings & attrPaths,
|
void processExpr(EvalState & state, const Strings & attrPaths,
|
||||||
bool parseOnly, bool strict, Bindings & autoArgs,
|
bool parseOnly, bool strict, Bindings & autoArgs,
|
||||||
bool evalOnly, OutputKind output, bool location, Expr * e)
|
bool evalOnly, OutputKind output, bool location, Expr * e)
|
||||||
|
@ -65,9 +62,9 @@ void processExpr(EvalState & state, const Strings & attrPaths,
|
||||||
vRes = v;
|
vRes = v;
|
||||||
else
|
else
|
||||||
state.autoCallFunction(autoArgs, v, vRes);
|
state.autoCallFunction(autoArgs, v, vRes);
|
||||||
if (output == OUTPUT_XML)
|
if (output == okXML)
|
||||||
printValueAsXML(state, strict, location, vRes, std::cout, context);
|
printValueAsXML(state, strict, location, vRes, std::cout, context);
|
||||||
else if (output == OUTPUT_JSON)
|
else if (output == okJSON)
|
||||||
printValueAsJSON(state, strict, vRes, std::cout, context);
|
printValueAsJSON(state, strict, vRes, std::cout, context);
|
||||||
else {
|
else {
|
||||||
if (strict) state.strictForceValue(vRes);
|
if (strict) state.strictForceValue(vRes);
|
||||||
|
@ -117,7 +114,7 @@ void run(Strings args)
|
||||||
bool findFile = false;
|
bool findFile = false;
|
||||||
bool evalOnly = false;
|
bool evalOnly = false;
|
||||||
bool parseOnly = false;
|
bool parseOnly = false;
|
||||||
OutputKind outputKind = OUTPUT_PLAIN;
|
OutputKind outputKind = okPlain;
|
||||||
bool xmlOutputSourceLocation = true;
|
bool xmlOutputSourceLocation = true;
|
||||||
bool strict = false;
|
bool strict = false;
|
||||||
Strings attrPaths;
|
Strings attrPaths;
|
||||||
|
@ -154,9 +151,9 @@ void run(Strings args)
|
||||||
else if (arg == "--indirect")
|
else if (arg == "--indirect")
|
||||||
indirectRoot = true;
|
indirectRoot = true;
|
||||||
else if (arg == "--xml")
|
else if (arg == "--xml")
|
||||||
outputKind = OUTPUT_XML;
|
outputKind = okXML;
|
||||||
else if (arg == "--json")
|
else if (arg == "--json")
|
||||||
outputKind = OUTPUT_JSON;
|
outputKind = okJSON;
|
||||||
else if (arg == "--no-location")
|
else if (arg == "--no-location")
|
||||||
xmlOutputSourceLocation = false;
|
xmlOutputSourceLocation = false;
|
||||||
else if (arg == "--strict")
|
else if (arg == "--strict")
|
||||||
|
|
Loading…
Reference in a new issue