aboutsummaryrefslogtreecommitdiff
path: root/src/libmain/common-args.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-16 14:07:32 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-16 14:07:32 +0200
commit3f264916dbfe346a71fa4182c9037332ac54f9d9 (patch)
tree94819bfb342195743f63321ee22f516df8d1fd22 /src/libmain/common-args.cc
parent36a124260361ba8dfa43bf43a067dcc48064c93f (diff)
parent2d6d53bc87ef7468ad73431cf76123316f4c82bf (diff)
Merge remote-tracking branch 'origin/flakes'
Diffstat (limited to 'src/libmain/common-args.cc')
-rw-r--r--src/libmain/common-args.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc
index 051668e53..09f4cd133 100644
--- a/src/libmain/common-args.cc
+++ b/src/libmain/common-args.cc
@@ -34,9 +34,19 @@ MixCommonArgs::MixCommonArgs(const string & programName)
try {
globalConfig.set(name, value);
} catch (UsageError & e) {
- warn(e.what());
+ if (!completions)
+ warn(e.what());
}
}},
+ .completer = [](size_t index, std::string_view prefix) {
+ if (index == 0) {
+ std::map<std::string, Config::SettingInfo> settings;
+ globalConfig.getSettings(settings);
+ for (auto & s : settings)
+ if (hasPrefix(s.first, prefix))
+ completions->insert(s.first);
+ }
+ }
});
addFlag({