mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Add ability to toggle show-trace from within the repl
This commit is contained in:
parent
2dc29e0d93
commit
a26351da02
2 changed files with 16 additions and 1 deletions
|
@ -2,3 +2,5 @@
|
||||||
|
|
||||||
* The TOML parser used by `builtins.fromTOML` has been replaced by [a
|
* The TOML parser used by `builtins.fromTOML` has been replaced by [a
|
||||||
more compliant one](https://github.com/ToruNiina/toml11).
|
more compliant one](https://github.com/ToruNiina/toml11).
|
||||||
|
* Added `:st`/`:show-trace` commands to nix repl, which are used to
|
||||||
|
set or toggle display of error traces.
|
||||||
|
|
|
@ -430,7 +430,8 @@ bool NixRepl::processLine(string line)
|
||||||
<< " :t <expr> Describe result of evaluation\n"
|
<< " :t <expr> Describe result of evaluation\n"
|
||||||
<< " :u <expr> Build derivation, then start nix-shell\n"
|
<< " :u <expr> Build derivation, then start nix-shell\n"
|
||||||
<< " :doc <expr> Show documentation of a builtin function\n"
|
<< " :doc <expr> Show documentation of a builtin function\n"
|
||||||
<< " :log <expr> Show logs for a derivation\n";
|
<< " :log <expr> Show logs for a derivation\n"
|
||||||
|
<< " :st [bool] Enable, disable or toggle showing traces for errors\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (command == ":a" || command == ":add") {
|
else if (command == ":a" || command == ":add") {
|
||||||
|
@ -572,6 +573,18 @@ bool NixRepl::processLine(string line)
|
||||||
throw Error("value does not have documentation");
|
throw Error("value does not have documentation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (command == ":st" || command == ":show-trace") {
|
||||||
|
if (arg == "false" || (arg == "" && loggerSettings.showTrace)) {
|
||||||
|
std::cout << "not showing error traces\n";
|
||||||
|
loggerSettings.showTrace = false;
|
||||||
|
} else if (arg == "true" || (arg == "" && !loggerSettings.showTrace)) {
|
||||||
|
std::cout << "showing error traces\n";
|
||||||
|
loggerSettings.showTrace = true;
|
||||||
|
} else {
|
||||||
|
throw Error("unexpected argument '%s' to %s", arg, command);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
else if (command != "")
|
else if (command != "")
|
||||||
throw Error("unknown command '%1%'", command);
|
throw Error("unknown command '%1%'", command);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue