nix verify: Restore the progress indicator

This commit is contained in:
Eelco Dolstra 2017-08-16 19:23:46 +02:00
parent b4ed97e3a3
commit c2cab20732
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 43 additions and 14 deletions

View file

@ -57,6 +57,8 @@ private:
std::map<ActivityType, ActivitiesByType> activitiesByType;
uint64_t filesLinked = 0, bytesLinked = 0;
uint64_t corruptedPaths = 0, untrustedPaths = 0;
};
Sync<State> state_;
@ -179,6 +181,16 @@ public:
update(*state);
}
}
else if (type == resUntrustedPath) {
state->untrustedPaths++;
update(*state);
}
else if (type == resCorruptedPath) {
state->corruptedPaths++;
update(*state);
}
}
void update()
@ -285,6 +297,19 @@ public:
}
}
// FIXME: don't show "done" paths in green.
showActivity(actVerifyPaths, "%s paths verified");
if (state.corruptedPaths) {
if (!res.empty()) res += ", ";
res += fmt(ANSI_RED "%d corrupted" ANSI_NORMAL, state.corruptedPaths);
}
if (state.untrustedPaths) {
if (!res.empty()) res += ", ";
res += fmt(ANSI_RED "%d untrusted" ANSI_NORMAL, state.untrustedPaths);
}
return res;
}
};