1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Implement --raw for nix-instantiate --eval

This commit is contained in:
Silvan Mosberger 2023-11-16 07:40:51 +01:00
parent e34c424279
commit 8bd591db03

View file

@ -22,7 +22,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,
@ -54,6 +54,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);
vRes.print(state.symbols, std::cout);
@ -134,6 +137,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")