aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/help-stores.md7
-rw-r--r--src/nix/main.cc32
-rw-r--r--src/nix/nix.md5
-rw-r--r--src/nix/store.cc7
-rw-r--r--src/nix/store.md9
5 files changed, 40 insertions, 20 deletions
diff --git a/src/nix/help-stores.md b/src/nix/help-stores.md
new file mode 100644
index 000000000..a33a7ea70
--- /dev/null
+++ b/src/nix/help-stores.md
@@ -0,0 +1,7 @@
+R"(
+
+Nix supports different types of stores. These are described below.
+
+@stores@
+
+)"
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 6caca9c22..5981028f7 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -223,6 +223,14 @@ static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel)
std::cout << renderMarkdownToTerminal(markdown) << "\n";
}
+static NixArgs & getNixArgs(Command & cmd)
+{
+ assert(cmd.parent);
+ MultiCommand * toplevel = cmd.parent;
+ while (toplevel->parent) toplevel = toplevel->parent;
+ return dynamic_cast<NixArgs &>(*toplevel);
+}
+
struct CmdHelp : Command
{
std::vector<std::string> subcommand;
@@ -252,12 +260,34 @@ struct CmdHelp : Command
assert(parent);
MultiCommand * toplevel = parent;
while (toplevel->parent) toplevel = toplevel->parent;
- showHelp(subcommand, dynamic_cast<NixArgs &>(*toplevel));
+ showHelp(subcommand, getNixArgs(*this));
}
};
static auto rCmdHelp = registerCommand<CmdHelp>("help");
+struct CmdHelpStores : Command
+{
+ std::string description() override
+ {
+ return "show help about store types and their settings";
+ }
+
+ std::string doc() override
+ {
+ return
+ #include "help-stores.md"
+ ;
+ }
+
+ void run() override
+ {
+ showHelp({"help-stores"}, getNixArgs(*this));
+ }
+};
+
+static auto rCmdHelpStores = registerCommand<CmdHelpStores>("help-stores");
+
void mainWrapped(int argc, char * * argv)
{
savedArgv = argv;
diff --git a/src/nix/nix.md b/src/nix/nix.md
index 0a90fa6c9..e1865b31c 100644
--- a/src/nix/nix.md
+++ b/src/nix/nix.md
@@ -220,8 +220,7 @@ operate are determined as follows:
# Nix stores
-Most `nix` subcommands operate on a *Nix store*.
-
-TODO: list store types, options
+Most `nix` subcommands operate on a *Nix store*. These are documented
+in [`nix help-stores`](./nix3-help-stores.md).
)""
diff --git a/src/nix/store.cc b/src/nix/store.cc
index 72b037488..2879e03b3 100644
--- a/src/nix/store.cc
+++ b/src/nix/store.cc
@@ -12,13 +12,6 @@ struct CmdStore : virtual NixMultiCommand
return "manipulate a Nix store";
}
- std::string doc() override
- {
- return
- #include "store.md"
- ;
- }
-
Category category() override { return catUtility; }
void run() override
diff --git a/src/nix/store.md b/src/nix/store.md
deleted file mode 100644
index d80a3b1be..000000000
--- a/src/nix/store.md
+++ /dev/null
@@ -1,9 +0,0 @@
-R"(
-
-# Store types
-
-Nix supports different types of stores. These are listed below.
-
-@stores@
-
-)"