aboutsummaryrefslogtreecommitdiff
path: root/src/libmain/common-args.cc
diff options
context:
space:
mode:
authorCarlo Nucera <carlo.nucera@protonmail.com>2020-07-28 15:36:45 -0400
committerCarlo Nucera <carlo.nucera@protonmail.com>2020-07-28 15:36:45 -0400
commitcfe96bd7ce06c3153b036447f9a933f2231a2029 (patch)
tree991e0e5b2adda907a9305e622fa54f7a401969d5 /src/libmain/common-args.cc
parentd9fb9e9f26e29d9d9001af700deada32ca740cf6 (diff)
parentb8eea7e81af53905be7845dffc6d0a83ea8edc97 (diff)
Merge branch 'master' of github.com:NixOS/nix into ca-drv
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({