aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-22 17:20:21 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-22 17:20:21 +0100
commit32f31a8c63d35a8ecfd341802465afacbe8d5759 (patch)
treeea37e304ef4d4cde34934084a2f4360f5713275a /src/nix/flake.cc
parent543288b6494f14fe09f72afe37290ee7e97e69a1 (diff)
nix flake info: Don't show empty descriptions
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 5bec5903f..bfff682d9 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -80,7 +80,8 @@ static void printFlakeInfo(const Store & store, const Flake & flake)
{
std::cout << fmt("URL: %s\n", flake.resolvedRef.input->to_string());
std::cout << fmt("Edition: %s\n", flake.edition);
- std::cout << fmt("Description: %s\n", flake.description);
+ if (flake.description)
+ std::cout << fmt("Description: %s\n", *flake.description);
std::cout << fmt("Path: %s\n", store.printStorePath(flake.sourceInfo->storePath));
if (flake.sourceInfo->rev)
std::cout << fmt("Revision: %s\n", flake.sourceInfo->rev->to_string(Base16, false));
@@ -94,7 +95,8 @@ static void printFlakeInfo(const Store & store, const Flake & flake)
static nlohmann::json flakeToJson(const Store & store, const Flake & flake)
{
nlohmann::json j;
- j["description"] = flake.description;
+ if (flake.description)
+ j["description"] = *flake.description;
j["edition"] = flake.edition;
j["url"] = flake.resolvedRef.input->to_string();
if (flake.sourceInfo->rev)