1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

nix-collect-garbage: Revive --max-freed

Fixes #609.
This commit is contained in:
Eelco Dolstra 2015-08-21 13:57:53 +02:00
parent 1d29db2a9f
commit eadb86f447
3 changed files with 11 additions and 18 deletions

View file

@ -50,11 +50,12 @@ void removeOldGenerations(std::string dir)
int main(int argc, char * * argv)
{
bool removeOld = false;
Strings extraArgs;
return handleExceptions(argv[0], [&]() {
initNix();
GCOptions options;
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--help")
showManPage("nix-collect-garbage");
@ -66,8 +67,12 @@ int main(int argc, char * * argv)
deleteOlderThan = getArg(*arg, arg, end);
}
else if (*arg == "--dry-run") dryRun = true;
else if (*arg == "--max-freed") {
long long maxFreed = getIntArg<long long>(*arg, arg, end, true);
options.maxFreed = maxFreed >= 0 ? maxFreed : 0;
}
else
extraArgs.push_back(*arg);
return false;
return true;
});
@ -77,7 +82,6 @@ int main(int argc, char * * argv)
// Run the actual garbage collector.
if (!dryRun) {
store = openStore(false);
GCOptions options;
options.action = GCOptions::gcDeleteDead;
GCResults results;
PrintFreed freed(true, results);