nix flake info: Don't show empty descriptions
This commit is contained in:
parent
543288b649
commit
32f31a8c63
|
@ -33,7 +33,7 @@ struct Flake
|
||||||
{
|
{
|
||||||
FlakeRef originalRef;
|
FlakeRef originalRef;
|
||||||
FlakeRef resolvedRef;
|
FlakeRef resolvedRef;
|
||||||
std::string description;
|
std::optional<std::string> description;
|
||||||
std::shared_ptr<const fetchers::Tree> sourceInfo;
|
std::shared_ptr<const fetchers::Tree> sourceInfo;
|
||||||
std::map<FlakeId, FlakeInput> inputs;
|
std::map<FlakeId, FlakeInput> inputs;
|
||||||
Value * vOutputs; // FIXME: gc
|
Value * vOutputs; // FIXME: gc
|
||||||
|
|
|
@ -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("URL: %s\n", flake.resolvedRef.input->to_string());
|
||||||
std::cout << fmt("Edition: %s\n", flake.edition);
|
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));
|
std::cout << fmt("Path: %s\n", store.printStorePath(flake.sourceInfo->storePath));
|
||||||
if (flake.sourceInfo->rev)
|
if (flake.sourceInfo->rev)
|
||||||
std::cout << fmt("Revision: %s\n", flake.sourceInfo->rev->to_string(Base16, false));
|
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)
|
static nlohmann::json flakeToJson(const Store & store, const Flake & flake)
|
||||||
{
|
{
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["description"] = flake.description;
|
if (flake.description)
|
||||||
|
j["description"] = *flake.description;
|
||||||
j["edition"] = flake.edition;
|
j["edition"] = flake.edition;
|
||||||
j["url"] = flake.resolvedRef.input->to_string();
|
j["url"] = flake.resolvedRef.input->to_string();
|
||||||
if (flake.sourceInfo->rev)
|
if (flake.sourceInfo->rev)
|
||||||
|
|
Loading…
Reference in a new issue