aboutsummaryrefslogtreecommitdiff
path: root/src/nix/nar.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
commitbd96403da6a1181e46a52be7befade0c00f9e743 (patch)
tree0f66b119acd03c11e2cad776087889b7827261dc /src/nix/nar.cc
parentbdc772022766e65fa8ea6d29fff0735529ab47f3 (diff)
parentec3e20283216374c15843c403363a890221d3fcb (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
Diffstat (limited to 'src/nix/nar.cc')
-rw-r--r--src/nix/nar.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nix/nar.cc b/src/nix/nar.cc
new file mode 100644
index 000000000..e239ce96a
--- /dev/null
+++ b/src/nix/nar.cc
@@ -0,0 +1,31 @@
+#include "command.hh"
+
+using namespace nix;
+
+struct CmdNar : NixMultiCommand
+{
+ CmdNar() : MultiCommand(RegisterCommand::getCommandsFor({"nar"}))
+ { }
+
+ std::string description() override
+ {
+ return "query the contents of NAR files";
+ }
+
+ Category category() override { return catUtility; }
+
+ void run() override
+ {
+ if (!command)
+ throw UsageError("'nix nar' 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 rCmdNar = registerCommand<CmdNar>("nar");