nix profile info: Index elements

This commit is contained in:
Eelco Dolstra 2019-10-22 00:28:16 +02:00
parent ce27920936
commit 555ca59f2b

View file

@ -14,6 +14,7 @@ using namespace nix;
struct ProfileElementSource struct ProfileElementSource
{ {
FlakeRef originalRef; FlakeRef originalRef;
// FIXME: record original attrpath.
FlakeRef resolvedRef; FlakeRef resolvedRef;
std::string attrPath; std::string attrPath;
// FIXME: output names // FIXME: output names
@ -193,8 +194,9 @@ struct CmdProfileInfo : virtual StoreCommand, MixDefaultProfile
{ {
ProfileManifest manifest(*profile); ProfileManifest manifest(*profile);
for (auto & element : manifest.elements) { for (size_t i = 0; i < manifest.elements.size(); ++i) {
std::cout << fmt("%s %s\n", auto & element(manifest.elements[i]);
std::cout << fmt("%d %s %s\n", i,
element.source ? element.source->originalRef.to_string() + "#" + element.source->attrPath : "-", element.source ? element.source->originalRef.to_string() + "#" + element.source->attrPath : "-",
element.source ? element.source->resolvedRef.to_string() + "#" + element.source->attrPath : "-", element.source ? element.source->resolvedRef.to_string() + "#" + element.source->attrPath : "-",
concatStringsSep(" ", element.storePaths)); concatStringsSep(" ", element.storePaths));