Skip to content

Commit 82df58f

Browse files
committed
Don't include undocumented commands in the manual
1 parent 05e2b13 commit 82df58f

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/libcmd/include/nix/cmd/command.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static constexpr Command::Category catHelp = -1;
2424
static constexpr Command::Category catSecondary = 100;
2525
static constexpr Command::Category catUtility = 101;
2626
static constexpr Command::Category catNixInstallation = 102;
27-
static constexpr Command::Category catUndocumented = 103;
2827

2928
static constexpr auto installablesCategory =
3029
"Options that change the interpretation of [installables](@docroot@/command-ref/new-cli/nix.md#installables)";

src/libutil/args.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ nlohmann::json MultiCommand::toJSON()
671671
auto command = commandFun();
672672
auto j = command->toJSON();
673673
auto cat = nlohmann::json::object();
674+
if (command->category() == Command::catUndocumented)
675+
continue;
674676
cat["id"] = command->category();
675677
cat["description"] = trim(categories[command->category()]);
676678
cat["experimental-feature"] = command->experimentalFeature();

src/libutil/include/nix/util/args.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ struct Command : virtual public Args
374374
using Category = int;
375375

376376
static constexpr Category catDefault = 0;
377+
static constexpr Category catUndocumented = 1;
377378

378379
virtual std::optional<ExperimentalFeature> experimentalFeature();
379380

src/nix/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
121121
categories.clear();
122122
categories[catHelp] = "Help commands";
123123
categories[Command::catDefault] = "Main commands";
124+
categories[Command::catUndocumented] = "Undocumented commands";
124125
categories[catSecondary] = "Infrequently used commands";
125126
categories[catUtility] = "Utility/scripting commands";
126127
categories[catNixInstallation] = "Commands for upgrading or troubleshooting your Nix installation";
127-
categories[catUndocumented] = "Undocumented commands";
128128

129129
addFlag({
130130
.longName = "help",

0 commit comments

Comments
 (0)