mirror of
https://github.com/NixOS/nix
synced 2025-06-30 11:43:15 +02:00
* In `--list-generations', show what the current generation is.
This commit is contained in:
parent
73ab2ed4fd
commit
b8675aee54
3 changed files with 30 additions and 13 deletions
|
@ -480,15 +480,17 @@ static void opListGenerations(Globals & globals,
|
|||
if (opArgs.size() != 0)
|
||||
throw UsageError(format("no arguments expected"));
|
||||
|
||||
Generations gens = findGenerations(globals.profile);
|
||||
int curGen;
|
||||
Generations gens = findGenerations(globals.profile, curGen);
|
||||
|
||||
for (Generations::iterator i = gens.begin(); i != gens.end(); ++i) {
|
||||
tm t;
|
||||
if (!localtime_r(&i->creationTime, &t)) throw Error("cannot convert time");
|
||||
cout << format("%|4| %|4|-%|02|-%|02| %|02|:%|02|:%|02|\n")
|
||||
cout << format("%|4| %|4|-%|02|-%|02| %|02|:%|02|:%|02| %||\n")
|
||||
% i->number
|
||||
% (t.tm_year + 1900) % (t.tm_mon + 1) % t.tm_mday
|
||||
% t.tm_hour % t.tm_min % t.tm_sec;
|
||||
% t.tm_hour % t.tm_min % t.tm_sec
|
||||
% (i->number == curGen ? "(current)" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue