From bf8a065be0d0cdccf5b6bc1034dc3e1709b21bd5 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 5 Jan 2022 12:28:31 -0700 Subject: [PATCH] add colors; remove headings --- src/libcmd/repl.cc | 2 -- src/libexpr/eval.cc | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 4cf93c26e..4ecbf51b5 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -444,7 +444,6 @@ bool NixRepl::processLine(string line) else if (command == ":d" || command == ":debug") { if (arg == "stack") { - std::cout << "eval stack:" << std::endl; for (auto iter = this->state->debugTraces.begin(); iter != this->state->debugTraces.end(); ++iter) { std::cout << "\n" << "… " << iter->hint.str() << "\n"; @@ -463,7 +462,6 @@ bool NixRepl::processLine(string line) } } } else if (arg == "env") { - std::cout << "env stack:" << std::endl; auto iter = this->state->debugTraces.begin(); if (iter != this->state->debugTraces.end()) { printStaticEnvBindings(iter->expr); diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index d9c26106e..585042b9d 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -679,12 +679,15 @@ std::optional EvalState::getDoc(Value & v) void printStaticEnvBindings(const StaticEnv &se, int lvl) { std::cout << "Env level " << lvl << std::endl; - + if (se.up) { + std::cout << ANSI_MAGENTA; for (auto i = se.vars.begin(); i != se.vars.end(); ++i) { std::cout << i->first << " "; } + std::cout << ANSI_NORMAL; + std::cout << std::endl; std::cout << std::endl; @@ -692,12 +695,14 @@ void printStaticEnvBindings(const StaticEnv &se, int lvl) } else { + std::cout << ANSI_MAGENTA; // for the top level, don't print the double underscore ones; they are in builtins. for (auto i = se.vars.begin(); i != se.vars.end(); ++i) { if (((string)i->first).substr(0,2) != "__") std::cout << i->first << " "; } + std::cout << ANSI_NORMAL; std::cout << std::endl; std::cout << std::endl;