aboutsummaryrefslogtreecommitdiff
path: root/src/nix/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-12-03 18:06:46 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-12-03 18:07:13 +0100
commit79c1967ded92574129c6a20116ef205a9c747bac (patch)
tree48a258950d6a102307179da747b4f63f6a26c683 /src/nix/store.cc
parent5781f45c46d7f6c55f87528ab1e754d070bc99ee (diff)
Introduce 'nix store' command
Diffstat (limited to 'src/nix/store.cc')
-rw-r--r--src/nix/store.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nix/store.cc b/src/nix/store.cc
new file mode 100644
index 000000000..e91bcc503
--- /dev/null
+++ b/src/nix/store.cc
@@ -0,0 +1,31 @@
+#include "command.hh"
+
+using namespace nix;
+
+struct CmdStore : virtual NixMultiCommand
+{
+ CmdStore() : MultiCommand(RegisterCommand::getCommandsFor({"store"}))
+ { }
+
+ std::string description() override
+ {
+ return "manipulate a Nix store";
+ }
+
+ Category category() override { return catUtility; }
+
+ void run() override
+ {
+ if (!command)
+ throw UsageError("'nix store' requires a sub-command.");
+ command->second->prepare();
+ command->second->run();
+ }
+
+ void printHelp(const string & programName, std::ostream & out) override
+ {
+ MultiCommand::printHelp(programName, out);
+ }
+};
+
+static auto rCmdStore = registerCommand<CmdStore>("store");