Merge pull request #8904 from wentasah/metadata-shows-last-modified

nix flakes metadata: Show lastModified timestamp for each input
This commit is contained in:
Eelco Dolstra 2023-10-16 13:52:51 +02:00 committed by GitHub
commit 6bf68c1e64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -233,9 +233,13 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
bool last = i + 1 == node.inputs.size(); bool last = i + 1 == node.inputs.size();
if (auto lockedNode = std::get_if<0>(&input.second)) { if (auto lockedNode = std::get_if<0>(&input.second)) {
logger->cout("%s" ANSI_BOLD "%s" ANSI_NORMAL ": %s", std::string lastModifiedStr = "";
if (auto lastModified = (*lockedNode)->lockedRef.input.getLastModified())
lastModifiedStr = fmt(" (%s)", std::put_time(std::gmtime(&*lastModified), "%F %T"));
logger->cout("%s" ANSI_BOLD "%s" ANSI_NORMAL ": %s%s",
prefix + (last ? treeLast : treeConn), input.first, prefix + (last ? treeLast : treeConn), input.first,
(*lockedNode)->lockedRef); (*lockedNode)->lockedRef,
lastModifiedStr);
bool firstVisit = visited.insert(*lockedNode).second; bool firstVisit = visited.insert(*lockedNode).second;