1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 00:16:11 -04:00

Compare commits

...

2 commits

Author SHA1 Message Date
Silvan Mosberger 57eb0a2bcf
Merge 8bd591db03 into ca3fc1693b 2024-09-20 08:43:05 +08:00
Silvan Mosberger 8bd591db03 Implement --raw for nix-instantiate --eval 2023-11-16 07:40:51 +01:00

View file

@ -24,7 +24,7 @@ static Path gcRoot;
static int rootNr = 0;
enum OutputKind { okPlain, okXML, okJSON };
enum OutputKind { okPlain, okXML, okJSON, okRaw };
void processExpr(EvalState & state, const Strings & attrPaths,
bool parseOnly, bool strict, Bindings & autoArgs,
@ -55,6 +55,9 @@ void processExpr(EvalState & state, const Strings & attrPaths,
else if (output == okJSON) {
printValueAsJSON(state, strict, vRes, v.determinePos(noPos), std::cout, context);
std::cout << std::endl;
} else if (output == okRaw) {
std::cout << *state.coerceToString(noPos, vRes, context, "while generating the nix-instantiate output");
std::cout << std::endl;
} else {
if (strict) state.forceValueDeep(vRes);
std::set<const void *> seen;
@ -136,6 +139,8 @@ static int main_nix_instantiate(int argc, char * * argv)
outputKind = okXML;
else if (*arg == "--json")
outputKind = okJSON;
else if (*arg == "--raw")
outputKind = okRaw;
else if (*arg == "--no-location")
xmlOutputSourceLocation = false;
else if (*arg == "--strict")