diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-28 15:36:45 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-28 15:36:45 -0400 |
commit | cfe96bd7ce06c3153b036447f9a933f2231a2029 (patch) | |
tree | 991e0e5b2adda907a9305e622fa54f7a401969d5 /src/libmain/common-args.cc | |
parent | d9fb9e9f26e29d9d9001af700deada32ca740cf6 (diff) | |
parent | b8eea7e81af53905be7845dffc6d0a83ea8edc97 (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.cc | 12 |
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({ |