aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-10-09 21:55:59 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-10-09 21:55:59 +0200
commit59bd6e87a44fab86c511f78ff50f3e3c4cca4b59 (patch)
treea0ac4909a218bd6caa54fa832dd7bcdc76cdba4a
parentea4b2b985f4c178ac86dfb1000aedddc17b4df61 (diff)
Completions::add(): Guard against newlines
-rw-r--r--src/libutil/args.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 66d8df085..8bd9c8aeb 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -19,10 +19,11 @@ void Args::addFlag(Flag && flag_)
void Completions::add(std::string completion, std::string description)
{
- insert(Completion{
- .completion = completion,
- .description = description
- });
+ assert(description.find('\n') == std::string::npos);
+ insert(Completion {
+ .completion = completion,
+ .description = description
+ });
}
bool Completion::operator<(const Completion & other) const