forked from lix-project/lix
nix why-depends: Write to stdout
This commit is contained in:
parent
e8d6ee7c1b
commit
d1c6e0fe8c
|
@ -156,7 +156,7 @@ struct CmdWhyDepends : SourceExprCommand
|
||||||
|
|
||||||
printNode = [&](Node & node, const string & firstPad, const string & tailPad) {
|
printNode = [&](Node & node, const string & firstPad, const string & tailPad) {
|
||||||
assert(node.dist != inf);
|
assert(node.dist != inf);
|
||||||
std::cerr << fmt("%s%s%s%s" ANSI_NORMAL "\n",
|
std::cout << fmt("%s%s%s%s" ANSI_NORMAL "\n",
|
||||||
firstPad,
|
firstPad,
|
||||||
node.visited ? "\e[38;5;244m" : "",
|
node.visited ? "\e[38;5;244m" : "",
|
||||||
firstPad != "" ? "=> " : "",
|
firstPad != "" ? "=> " : "",
|
||||||
|
@ -209,7 +209,7 @@ struct CmdWhyDepends : SourceExprCommand
|
||||||
for (auto & hash : hashes) {
|
for (auto & hash : hashes) {
|
||||||
auto pos = contents.find(hash);
|
auto pos = contents.find(hash);
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
size_t margin = 16;
|
size_t margin = 32;
|
||||||
auto pos2 = pos >= margin ? pos - margin : 0;
|
auto pos2 = pos >= margin ? pos - margin : 0;
|
||||||
hits[hash].emplace_back(fmt("%s: …%s…\n",
|
hits[hash].emplace_back(fmt("%s: …%s…\n",
|
||||||
p2,
|
p2,
|
||||||
|
@ -244,7 +244,7 @@ struct CmdWhyDepends : SourceExprCommand
|
||||||
|
|
||||||
for (auto & hit : hits[hash]) {
|
for (auto & hit : hits[hash]) {
|
||||||
bool first = hit == *hits[hash].begin();
|
bool first = hit == *hits[hash].begin();
|
||||||
std::cerr << tailPad
|
std::cout << tailPad
|
||||||
<< (first ? (last ? treeLast : treeConn) : (last ? treeNull : treeLine))
|
<< (first ? (last ? treeLast : treeConn) : (last ? treeNull : treeLine))
|
||||||
<< hit;
|
<< hit;
|
||||||
if (!all) break;
|
if (!all) break;
|
||||||
|
|
Loading…
Reference in a new issue