diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-14T19·14+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-15T13·39+0200 |
commit | 99851c6f06c80fe2222c5e5fcef963804e907170 (patch) | |
tree | f28eaed5d273ab8ac7d2805dfe36dcb810976f76 /src/nix/command.cc | |
parent | 327569035c70b6171347e5c9c0cd3de4fd7383eb (diff) |
Unify "nix verify-paths" and "nix verify-store"
"verify-store" is now simply an "--all" flag to "nix verify". This flag can be used for any other store path command as well (e.g. "nix path-info", "nix copy-sigs", ...).
Diffstat (limited to 'src/nix/command.cc')
-rw-r--r-- | src/nix/command.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc index a89246a937c1..986953fd845d 100644 --- a/src/nix/command.cc +++ b/src/nix/command.cc @@ -73,18 +73,28 @@ StorePathsCommand::StorePathsCommand() { expectArgs("paths", &storePaths); mkFlag('r', "recursive", "apply operation to closure of the specified paths", &recursive); + mkFlag(0, "all", "apply operation to the entire store", &all); } void StorePathsCommand::run(ref<Store> store) { - for (auto & storePath : storePaths) - storePath = followLinksToStorePath(storePath); + if (all) { + if (storePaths.size()) + throw UsageError("‘--all’ does not expect arguments"); + for (auto & p : store->queryAllValidPaths()) + storePaths.push_back(p); + } - if (recursive) { - PathSet closure; + else { for (auto & storePath : storePaths) - store->computeFSClosure(storePath, closure, false, false); - storePaths = store->topoSortPaths(closure); + storePath = followLinksToStorePath(storePath); + + if (recursive) { + PathSet closure; + for (auto & storePath : storePaths) + store->computeFSClosure(storePath, closure, false, false); + storePaths = store->topoSortPaths(closure); + } } run(store, storePaths); |