1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 09:11:47 +02:00

nix-store --gc --max-freed: Support a unit specifier

E.g. "--max-freed 10G" means "free ten gigabytes".
This commit is contained in:
Eelco Dolstra 2014-02-17 14:48:50 +01:00
parent 00d30496ca
commit 1da6ae4f99
3 changed files with 25 additions and 6 deletions

View file

@ -619,7 +619,7 @@ static void opGC(Strings opFlags, Strings opArgs)
else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead;
else if (*i == "--delete") options.action = GCOptions::gcDeleteDead;
else if (*i == "--max-freed") {
long long maxFreed = getIntArg<long long>(*i, i, opFlags.end());
long long maxFreed = getIntArg<long long>(*i, i, opFlags.end(), true);
options.maxFreed = maxFreed >= 0 ? maxFreed : 0;
}
else throw UsageError(format("bad sub-operation `%1%' in GC") % *i);