forked from lix-project/lix
nix: Add --store flag
This is a bit user-friendlier than using $NIX_REMOTE.
This commit is contained in:
parent
1c5f73f529
commit
cebc150b7c
|
@ -57,9 +57,16 @@ bool MultiCommand::processArgs(const Strings & args, bool finish)
|
||||||
return Args::processArgs(args, finish);
|
return Args::processArgs(args, finish);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoreCommand::StoreCommand()
|
||||||
|
{
|
||||||
|
storeUri = getEnv("NIX_REMOTE");
|
||||||
|
|
||||||
|
mkFlag(0, "store", "store-uri", "URI of the Nix store to use", &storeUri);
|
||||||
|
}
|
||||||
|
|
||||||
void StoreCommand::run()
|
void StoreCommand::run()
|
||||||
{
|
{
|
||||||
run(openStore());
|
run(openStoreAt(storeUri));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,8 @@ class Store;
|
||||||
/* A command that require a Nix store. */
|
/* A command that require a Nix store. */
|
||||||
struct StoreCommand : virtual Command
|
struct StoreCommand : virtual Command
|
||||||
{
|
{
|
||||||
bool reserveSpace;
|
std::string storeUri;
|
||||||
StoreCommand(bool reserveSpace = true)
|
StoreCommand();
|
||||||
: reserveSpace(reserveSpace) { };
|
|
||||||
void run() override;
|
void run() override;
|
||||||
virtual void run(ref<Store>) = 0;
|
virtual void run(ref<Store>) = 0;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue