mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-08 11:17:18 +02:00
![Théophane Hufschmitt](/assets/img/avatar_default.png)
* Factor out the default `MultiCommand` behavior All the `MultiCommand`s had (nearly) the same behavior when called without a subcommand. Factor out this behavior into the `NixMultiCommand` class. * Display the list of available subcommands when none is specified Whenever a user runs a command that excepts a subcommand, add the list of available subcommands to the error message. * Print the multi-command lists as Markdown lists This takes more screen real estate, but is also much more readable than a comma-separated list
25 lines
479 B
C++
25 lines
479 B
C++
#include "command.hh"
|
|
|
|
using namespace nix;
|
|
|
|
struct CmdNar : NixMultiCommand
|
|
{
|
|
CmdNar() : NixMultiCommand("nar", RegisterCommand::getCommandsFor({"nar"}))
|
|
{ }
|
|
|
|
std::string description() override
|
|
{
|
|
return "create or inspect NAR files";
|
|
}
|
|
|
|
std::string doc() override
|
|
{
|
|
return
|
|
#include "nar.md"
|
|
;
|
|
}
|
|
|
|
Category category() override { return catUtility; }
|
|
};
|
|
|
|
static auto rCmdNar = registerCommand<CmdNar>("nar");
|