mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 17:46:46 +02:00
nix flake metadata: Don't show locked URL if it's not locked
This is the case for e.g. dirty Git workdirs, where we would get $ nix flake metadata Resolved URL: git+file:///home/eelco/Dev/nix-master Locked URL: git+file:///home/eelco/Dev/nix-master
This commit is contained in:
parent
2306e96767
commit
32bf39c73a
1 changed files with 6 additions and 3 deletions
|
@ -219,6 +219,8 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
|
||||||
j["resolvedUrl"] = flake.resolvedRef.to_string();
|
j["resolvedUrl"] = flake.resolvedRef.to_string();
|
||||||
j["resolved"] = fetchers::attrsToJSON(flake.resolvedRef.toAttrs());
|
j["resolved"] = fetchers::attrsToJSON(flake.resolvedRef.toAttrs());
|
||||||
j["url"] = flake.lockedRef.to_string(); // FIXME: rename to lockedUrl
|
j["url"] = flake.lockedRef.to_string(); // FIXME: rename to lockedUrl
|
||||||
|
// "locked" is a misnomer - this is the result of the
|
||||||
|
// attempt to lock.
|
||||||
j["locked"] = fetchers::attrsToJSON(flake.lockedRef.toAttrs());
|
j["locked"] = fetchers::attrsToJSON(flake.lockedRef.toAttrs());
|
||||||
if (auto rev = flake.lockedRef.input.getRev())
|
if (auto rev = flake.lockedRef.input.getRev())
|
||||||
j["revision"] = rev->to_string(HashFormat::Base16, false);
|
j["revision"] = rev->to_string(HashFormat::Base16, false);
|
||||||
|
@ -235,6 +237,7 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
|
||||||
logger->cout(
|
logger->cout(
|
||||||
ANSI_BOLD "Resolved URL:" ANSI_NORMAL " %s",
|
ANSI_BOLD "Resolved URL:" ANSI_NORMAL " %s",
|
||||||
flake.resolvedRef.to_string());
|
flake.resolvedRef.to_string());
|
||||||
|
if (flake.lockedRef.input.isLocked())
|
||||||
logger->cout(
|
logger->cout(
|
||||||
ANSI_BOLD "Locked URL:" ANSI_NORMAL " %s",
|
ANSI_BOLD "Locked URL:" ANSI_NORMAL " %s",
|
||||||
flake.lockedRef.to_string());
|
flake.lockedRef.to_string());
|
||||||
|
|
Loading…
Reference in a new issue