Replace some bool recursive with a new FileIngestionMethod enum

This commit is contained in:
John Ericson
2020-03-29 15:16:20 -04:00
parent eb1911e277
commit 225e62a56a
27 changed files with 105 additions and 87 deletions
+5 -5
View File
@@ -28,20 +28,20 @@ void StoreCommand::run()
run(getStore());
}
StorePathsCommand::StorePathsCommand(bool recursive)
StorePathsCommand::StorePathsCommand(FileIngestionMethod recursive)
: recursive(recursive)
{
if (recursive)
if (recursive == FileIngestionMethod::Recursive)
mkFlag()
.longName("no-recursive")
.description("apply operation to specified paths only")
.set(&this->recursive, false);
.set(&this->recursive, FileIngestionMethod::Flat);
else
mkFlag()
.longName("recursive")
.shortName('r')
.description("apply operation to closure of the specified paths")
.set(&this->recursive, true);
.set(&this->recursive, FileIngestionMethod::Recursive);
mkFlag(0, "all", "apply operation to the entire store", &all);
}
@@ -61,7 +61,7 @@ void StorePathsCommand::run(ref<Store> store)
for (auto & p : toStorePaths(store, realiseMode, installables))
storePaths.push_back(p.clone());
if (recursive) {
if (recursive == FileIngestionMethod::Recursive) {
StorePathSet closure;
store->computeFSClosure(storePathsToSet(storePaths), closure, false, false);
storePaths.clear();