mirror of
https://github.com/NixOS/nix
synced 2025-06-28 13:41:15 +02:00
Command: Remove examples()
This commit is contained in:
parent
c9279b831e
commit
1047cb1e53
3 changed files with 0 additions and 49 deletions
|
@ -353,36 +353,6 @@ void printTable(std::ostream & out, const Table2 & table)
|
|||
}
|
||||
}
|
||||
|
||||
void Command::printHelp(const string & programName, std::ostream & out)
|
||||
{
|
||||
Args::printHelp(programName, out);
|
||||
|
||||
auto exs = examples();
|
||||
if (!exs.empty()) {
|
||||
out << "\n" ANSI_BOLD "Examples:" ANSI_NORMAL "\n";
|
||||
for (auto & ex : exs)
|
||||
out << "\n"
|
||||
<< " " << ex.description << "\n" // FIXME: wrap
|
||||
<< " $ " << ex.command << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
nlohmann::json Command::toJSON()
|
||||
{
|
||||
auto exs = nlohmann::json::array();
|
||||
|
||||
for (auto & example : examples()) {
|
||||
auto ex = nlohmann::json::object();
|
||||
ex["description"] = example.description;
|
||||
ex["command"] = chomp(stripIndentation(example.command));
|
||||
exs.push_back(std::move(ex));
|
||||
}
|
||||
|
||||
auto res = Args::toJSON();
|
||||
res["examples"] = std::move(exs);
|
||||
return res;
|
||||
}
|
||||
|
||||
MultiCommand::MultiCommand(const Commands & commands)
|
||||
: commands(commands)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue