about summary refs log tree commit diff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-10-10T13·43+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-10-10T13·43+0000
commit315183f194881591480d9acd1eef685d6b64d7f8 (patch)
tree542c4e374774f0f2d2de56f520160c728ef53ab0 /src/nix-store/nix-store.cc
parenta8629de827e4d5a67372614727ce6fcc26423f8c (diff)
* nix-store --optimise: flag "--dry-run" to just query what the disk
  savings would be.

Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 678ce2ae9c62..0d474946bfa5 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -640,16 +640,19 @@ static void opOptimise(Strings opFlags, Strings opArgs)
     if (!opArgs.empty())
         throw UsageError("no arguments expected");
 
+    bool dryRun = false;
+
     for (Strings::iterator i = opFlags.begin();
          i != opFlags.end(); ++i)
-        throw UsageError(format("unknown flag `%1%'") % *i);
+        if (*i == "--dry-run") dryRun = true;
+        else throw UsageError(format("unknown flag `%1%'") % *i);
 
     LocalStore * store2(dynamic_cast<LocalStore *>(store.get()));
     if (!store2) throw Error("you don't have sufficient rights to use --optimise");
 
     OptimiseStats stats;
     try {
-        store2->optimiseStore(true, stats);
+        store2->optimiseStore(dryRun, stats);
     } catch (...) {
         showOptimiseStats(stats);
         throw;