forked from lix-project/lix
Move store docs to 'nix help-stores'
Why not 'nix help stores'? Well, 'nix help <arg>' already means 'show help on the "arg" subcommand'.
This commit is contained in:
parent
3fc4659d22
commit
233b063b08
|
@ -97,7 +97,10 @@ public:
|
||||||
Path nixDaemonSocketFile;
|
Path nixDaemonSocketFile;
|
||||||
|
|
||||||
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store",
|
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store",
|
||||||
"The default Nix store to use."};
|
R"(
|
||||||
|
The URL of the Nix store to use. See [`nix help-stores`](@docroot@/command-ref/new-cli/nix3-help-stores.md)
|
||||||
|
for supported store types and settings.
|
||||||
|
)"};
|
||||||
|
|
||||||
Setting<bool> keepFailed{this, false, "keep-failed",
|
Setting<bool> keepFailed{this, false, "keep-failed",
|
||||||
"Whether to keep temporary directories of failed builds."};
|
"Whether to keep temporary directories of failed builds."};
|
||||||
|
|
7
src/nix/help-stores.md
Normal file
7
src/nix/help-stores.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
R"(
|
||||||
|
|
||||||
|
Nix supports different types of stores. These are described below.
|
||||||
|
|
||||||
|
@stores@
|
||||||
|
|
||||||
|
)"
|
|
@ -223,6 +223,14 @@ static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel)
|
||||||
std::cout << renderMarkdownToTerminal(markdown) << "\n";
|
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
|
struct CmdHelp : Command
|
||||||
{
|
{
|
||||||
std::vector<std::string> subcommand;
|
std::vector<std::string> subcommand;
|
||||||
|
@ -252,12 +260,34 @@ struct CmdHelp : Command
|
||||||
assert(parent);
|
assert(parent);
|
||||||
MultiCommand * toplevel = parent;
|
MultiCommand * toplevel = parent;
|
||||||
while (toplevel->parent) toplevel = toplevel->parent;
|
while (toplevel->parent) toplevel = toplevel->parent;
|
||||||
showHelp(subcommand, dynamic_cast<NixArgs &>(*toplevel));
|
showHelp(subcommand, getNixArgs(*this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto rCmdHelp = registerCommand<CmdHelp>("help");
|
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)
|
void mainWrapped(int argc, char * * argv)
|
||||||
{
|
{
|
||||||
savedArgv = argv;
|
savedArgv = argv;
|
||||||
|
|
|
@ -220,8 +220,7 @@ operate are determined as follows:
|
||||||
|
|
||||||
# Nix stores
|
# Nix stores
|
||||||
|
|
||||||
Most `nix` subcommands operate on a *Nix store*.
|
Most `nix` subcommands operate on a *Nix store*. These are documented
|
||||||
|
in [`nix help-stores`](./nix3-help-stores.md).
|
||||||
TODO: list store types, options
|
|
||||||
|
|
||||||
)""
|
)""
|
||||||
|
|
|
@ -12,13 +12,6 @@ struct CmdStore : virtual NixMultiCommand
|
||||||
return "manipulate a Nix store";
|
return "manipulate a Nix store";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string doc() override
|
|
||||||
{
|
|
||||||
return
|
|
||||||
#include "store.md"
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Category category() override { return catUtility; }
|
Category category() override { return catUtility; }
|
||||||
|
|
||||||
void run() override
|
void run() override
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
R"(
|
|
||||||
|
|
||||||
# Store types
|
|
||||||
|
|
||||||
Nix supports different types of stores. These are listed below.
|
|
||||||
|
|
||||||
@stores@
|
|
||||||
|
|
||||||
)"
|
|
Loading…
Reference in a new issue