aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-03-21 14:43:58 +0100
committerEelco Dolstra <edolstra@gmail.com>2023-03-21 14:43:58 +0100
commitc967c29290b1d0b7ea5a169c39324ddca46403ba (patch)
tree9cd03013aee0959f96ddbfc8ecff86661190cef3
parent233b063b08b6a82921d26fb5a86e15c2b94a72ee (diff)
Add a "help" category
This makes the help commands show up prominently at the top of the 'nix' manpage.
-rw-r--r--src/libcmd/command.hh1
-rw-r--r--src/nix/main.cc5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh
index 874ca3249..b7a87dad0 100644
--- a/src/libcmd/command.hh
+++ b/src/libcmd/command.hh
@@ -18,6 +18,7 @@ class EvalState;
struct Pos;
class Store;
+static constexpr Command::Category catHelp = -1;
static constexpr Command::Category catSecondary = 100;
static constexpr Command::Category catUtility = 101;
static constexpr Command::Category catNixInstallation = 102;
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 5981028f7..ffe558ee8 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -65,6 +65,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
NixArgs() : MultiCommand(RegisterCommand::getCommandsFor({})), MixCommonArgs("nix")
{
categories.clear();
+ categories[catHelp] = "Help commands";
categories[Command::catDefault] = "Main commands";
categories[catSecondary] = "Infrequently used commands";
categories[catUtility] = "Utility/scripting commands";
@@ -255,6 +256,8 @@ struct CmdHelp : Command
;
}
+ Category category() override { return catHelp; }
+
void run() override
{
assert(parent);
@@ -280,6 +283,8 @@ struct CmdHelpStores : Command
;
}
+ Category category() override { return catHelp; }
+
void run() override
{
showHelp({"help-stores"}, getNixArgs(*this));