mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 23:02:27 +00:00
parent
67a5941472
commit
efaffaa9d1
@ -50,7 +50,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
||||
if (!dryRun)
|
||||
store->addToStore(info, sink.s);
|
||||
|
||||
std::cout << fmt("%s\n", store->printStorePath(info.path));
|
||||
logger->stdout("%s", store->printStorePath(info.path));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -55,16 +55,15 @@ struct CmdEval : MixJSON, InstallableCommand
|
||||
auto v = installable->toValue(*state).first;
|
||||
PathSet context;
|
||||
|
||||
stopProgressBar();
|
||||
|
||||
if (raw) {
|
||||
stopProgressBar();
|
||||
std::cout << state->coerceToString(noPos, *v, context);
|
||||
} else if (json) {
|
||||
JSONPlaceholder jsonOut(std::cout);
|
||||
printValueAsJSON(*state, true, *v, jsonOut, context);
|
||||
} else {
|
||||
state->forceValueDeep(*v);
|
||||
std::cout << *v << "\n";
|
||||
logger->stdout("%s", *v);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -60,8 +60,7 @@ struct CmdHash : Command
|
||||
|
||||
Hash h = hashSink->finish().first;
|
||||
if (truncate && h.hashSize > 20) h = compressHash(h, 20);
|
||||
std::cout << format("%1%\n") %
|
||||
h.to_string(base, base == SRI);
|
||||
logger->stdout(h.to_string(base, base == SRI));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -95,7 +94,7 @@ struct CmdToBase : Command
|
||||
void run() override
|
||||
{
|
||||
for (auto s : args)
|
||||
std::cout << fmt("%s\n", Hash(s, ht).to_string(base, base == SRI));
|
||||
logger->stdout(Hash(s, ht).to_string(base, base == SRI));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -34,16 +34,14 @@ struct MixLs : virtual Args, MixJSON
|
||||
(st.isExecutable ? "-r-xr-xr-x" : "-r--r--r--") :
|
||||
st.type == FSAccessor::Type::tSymlink ? "lrwxrwxrwx" :
|
||||
"dr-xr-xr-x";
|
||||
std::cout <<
|
||||
(format("%s %20d %s") % tp % st.fileSize % relPath);
|
||||
auto line = fmt("%s %20d %s", tp, st.fileSize, relPath);
|
||||
if (st.type == FSAccessor::Type::tSymlink)
|
||||
std::cout << " -> " << accessor->readLink(curPath)
|
||||
;
|
||||
std::cout << "\n";
|
||||
line += " -> " + accessor->readLink(curPath);
|
||||
logger->stdout(line);
|
||||
if (recursive && st.type == FSAccessor::Type::tDirectory)
|
||||
doPath(st, curPath, relPath, false);
|
||||
} else {
|
||||
std::cout << relPath << "\n";
|
||||
logger->stdout(relPath);
|
||||
if (recursive) {
|
||||
auto st = accessor->stat(curPath);
|
||||
if (st.type == FSAccessor::Type::tDirectory)
|
||||
|
@ -23,7 +23,7 @@ struct CmdShowConfig : Command, MixJSON
|
||||
std::map<std::string, Config::SettingInfo> settings;
|
||||
globalConfig.getSettings(settings);
|
||||
for (auto & s : settings)
|
||||
std::cout << s.first + " = " + s.second.value + "\n";
|
||||
logger->stdout("%s = %s", s.first, s.second.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -149,7 +149,7 @@ struct CmdWhyDepends : SourceExprCommand
|
||||
auto pathS = store->printStorePath(node.path);
|
||||
|
||||
assert(node.dist != inf);
|
||||
std::cout << fmt("%s%s%s%s" ANSI_NORMAL "\n",
|
||||
logger->stdout("%s%s%s%s" ANSI_NORMAL,
|
||||
firstPad,
|
||||
node.visited ? "\e[38;5;244m" : "",
|
||||
firstPad != "" ? "→ " : "",
|
||||
|
Loading…
Reference in New Issue
Block a user