run(): Move

This commit is contained in:
Eelco Dolstra 2021-09-27 10:53:09 +02:00
parent 283e7da470
commit a15e65eef0
10 changed files with 15 additions and 15 deletions

View file

@ -138,7 +138,7 @@ StorePathsCommand::StorePathsCommand(bool recursive)
{ {
} }
void StorePathsCommand::run(ref<Store> store, BuiltPaths paths) void StorePathsCommand::run(ref<Store> store, BuiltPaths && paths)
{ {
StorePaths storePaths; StorePaths storePaths;
for (auto& builtPath : paths) for (auto& builtPath : paths)
@ -148,7 +148,7 @@ void StorePathsCommand::run(ref<Store> store, BuiltPaths paths)
run(store, std::move(storePaths)); run(store, std::move(storePaths));
} }
void StorePathCommand::run(ref<Store> store, std::vector<StorePath> storePaths) void StorePathCommand::run(ref<Store> store, std::vector<StorePath> && storePaths)
{ {
if (storePaths.size() != 1) if (storePaths.size() != 1)
throw UsageError("this command requires exactly one store path"); throw UsageError("this command requires exactly one store path");

View file

@ -169,7 +169,7 @@ public:
using StoreCommand::run; using StoreCommand::run;
virtual void run(ref<Store> store, BuiltPaths paths) = 0; virtual void run(ref<Store> store, BuiltPaths && paths) = 0;
void run(ref<Store> store) override; void run(ref<Store> store) override;
@ -182,9 +182,9 @@ struct StorePathsCommand : public BuiltPathsCommand
using BuiltPathsCommand::run; using BuiltPathsCommand::run;
virtual void run(ref<Store> store, std::vector<StorePath> storePaths) = 0; virtual void run(ref<Store> store, std::vector<StorePath> && storePaths) = 0;
void run(ref<Store> store, BuiltPaths paths) override; void run(ref<Store> store, BuiltPaths && paths) override;
}; };
/* A command that operates on exactly one store path. */ /* A command that operates on exactly one store path. */
@ -194,7 +194,7 @@ struct StorePathCommand : public StorePathsCommand
virtual void run(ref<Store> store, const StorePath & storePath) = 0; virtual void run(ref<Store> store, const StorePath & storePath) = 0;
void run(ref<Store> store, std::vector<StorePath> storePaths) override; void run(ref<Store> store, std::vector<StorePath> && storePaths) override;
}; };
/* A helper class for registering commands globally. */ /* A helper class for registering commands globally. */

View file

@ -78,7 +78,7 @@ struct CmdCopy : BuiltPathsCommand
BuiltPathsCommand::run(store); BuiltPathsCommand::run(store);
} }
void run(ref<Store> srcStore, BuiltPaths paths) override void run(ref<Store> srcStore, BuiltPaths && paths) override
{ {
ref<Store> dstStore = dstUri.empty() ? openStore() : openStore(dstUri); ref<Store> dstStore = dstUri.empty() ? openStore() : openStore(dstUri);

View file

@ -25,7 +25,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
; ;
} }
void run(ref<Store> store, StorePaths storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
auto paths = store->topoSortPaths(StorePathSet(storePaths.begin(), storePaths.end())); auto paths = store->topoSortPaths(StorePathSet(storePaths.begin(), storePaths.end()));

View file

@ -79,7 +79,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
std::cout << fmt("\t%6.1f%c", res, idents.at(power)); std::cout << fmt("\t%6.1f%c", res, idents.at(power));
} }
void run(ref<Store> store, StorePaths storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
size_t pathLen = 0; size_t pathLen = 0;
for (auto & storePath : storePaths) for (auto & storePath : storePaths)

View file

@ -44,7 +44,7 @@ struct CmdRealisationInfo : BuiltPathsCommand, MixJSON
Category category() override { return catSecondary; } Category category() override { return catSecondary; }
void run(ref<Store> store, BuiltPaths paths) override void run(ref<Store> store, BuiltPaths && paths) override
{ {
settings.requireExperimentalFeature("ca-derivations"); settings.requireExperimentalFeature("ca-derivations");
RealisedPath::Set realisations; RealisedPath::Set realisations;

View file

@ -27,7 +27,7 @@ struct CmdCopySigs : StorePathsCommand
return "copy store path signatures from substituters"; return "copy store path signatures from substituters";
} }
void run(ref<Store> store, StorePaths storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
if (substituterUris.empty()) if (substituterUris.empty())
throw UsageError("you must specify at least one substituter using '-s'"); throw UsageError("you must specify at least one substituter using '-s'");
@ -113,7 +113,7 @@ struct CmdSign : StorePathsCommand
return "sign store paths"; return "sign store paths";
} }
void run(ref<Store> store, StorePaths storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
if (secretKeyFile.empty()) if (secretKeyFile.empty())
throw UsageError("you must specify a secret key file using '-k'"); throw UsageError("you must specify a secret key file using '-k'");

View file

@ -30,7 +30,7 @@ struct CmdStoreDelete : StorePathsCommand
; ;
} }
void run(ref<Store> store, std::vector<StorePath> storePaths) override void run(ref<Store> store, std::vector<StorePath> && storePaths) override
{ {
for (auto & path : storePaths) for (auto & path : storePaths)
options.pathsToDelete.insert(path); options.pathsToDelete.insert(path);

View file

@ -17,7 +17,7 @@ struct CmdStoreRepair : StorePathsCommand
; ;
} }
void run(ref<Store> store, std::vector<StorePath> storePaths) override void run(ref<Store> store, std::vector<StorePath> && storePaths) override
{ {
for (auto & path : storePaths) for (auto & path : storePaths)
store->repairPath(path); store->repairPath(path);

View file

@ -59,7 +59,7 @@ struct CmdVerify : StorePathsCommand
; ;
} }
void run(ref<Store> store, StorePaths storePaths) override void run(ref<Store> store, StorePaths && storePaths) override
{ {
std::vector<ref<Store>> substituters; std::vector<ref<Store>> substituters;
for (auto & s : substituterUris) for (auto & s : substituterUris)