diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-09-13 17:40:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 17:40:22 +0200 |
commit | b8f334bd8520d6fc9eb33258cc75d4acb57554b1 (patch) | |
tree | 7929078323691fabc75e9a4a863f143579937761 /src | |
parent | b56906aae025b467111e67ed7b1bab485b3dbba5 (diff) | |
parent | d365cced4fadbbc63f0c39902a7091e1a34c34de (diff) |
Merge pull request #7034 from edolstra/trim-descriptions
Trim option descriptions
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/args.cc | 6 | ||||
-rw-r--r-- | src/nix/main.cc | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 44b63f0f6..753980fd4 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -216,7 +216,7 @@ nlohmann::json Args::toJSON() if (flag->shortName) j["shortName"] = std::string(1, flag->shortName); if (flag->description != "") - j["description"] = flag->description; + j["description"] = trim(flag->description); j["category"] = flag->category; if (flag->handler.arity != ArityAny) j["arity"] = flag->handler.arity; @@ -237,7 +237,7 @@ nlohmann::json Args::toJSON() } auto res = nlohmann::json::object(); - res["description"] = description(); + res["description"] = trim(description()); res["flags"] = std::move(flags); res["args"] = std::move(args); auto s = doc(); @@ -379,7 +379,7 @@ nlohmann::json MultiCommand::toJSON() auto j = command->toJSON(); auto cat = nlohmann::json::object(); cat["id"] = command->category(); - cat["description"] = categories[command->category()]; + cat["description"] = trim(categories[command->category()]); j["category"] = std::move(cat); cmds[name] = std::move(j); } diff --git a/src/nix/main.cc b/src/nix/main.cc index f434e9655..e0155cd5d 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -325,7 +325,7 @@ void mainWrapped(int argc, char * * argv) std::cout << "attrs\n"; break; } for (auto & s : *completions) - std::cout << s.completion << "\t" << s.description << "\n"; + std::cout << s.completion << "\t" << trim(s.description) << "\n"; } }); |