1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-12 21:46:01 +01:00

Factor out --from / --to logic

This commit is contained in:
Eelco Dolstra 2022-01-17 13:58:26 +01:00
parent f6f0bcf11f
commit 6448ea84ab
3 changed files with 66 additions and 44 deletions

View file

@ -176,6 +176,23 @@ public:
bool useDefaultInstallables() override { return !all; }
};
/* A command that copies something between `--from` and `--to`
stores. */
struct CopyCommand : virtual BuiltPathsCommand
{
std::string srcUri, dstUri;
CopyCommand();
ref<Store> createStore() override;
void run(ref<Store> store) override;
void run(ref<Store> srcStore, BuiltPaths && paths) override;
virtual void run(ref<Store> srcStore, ref<Store> dstStore, BuiltPaths && paths) = 0;
};
struct StorePathsCommand : public BuiltPathsCommand
{
StorePathsCommand(bool recursive = false);