diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-02-24 15:28:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 15:28:19 +0100 |
commit | 199081ad00e6ee4c704eaac34211b454fe0f310c (patch) | |
tree | 0d6d62aaa13ace160111c1c9580a9a7ccc6ba818 /src/libstore/globals.cc | |
parent | a878c448d84f087ee1dfdde95a51614187aa170c (diff) | |
parent | f6c5b05488c588964f51ce97ad2c297fbca7ce96 (diff) |
Merge pull request #4486 from shlevy/command-plugins-v2
Command plugins
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r-- | src/libstore/globals.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index df07aee9b..2780e0bf5 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -243,8 +243,17 @@ void MaxBuildJobsSetting::set(const std::string & str, bool append) } +void PluginFilesSetting::set(const std::string & str, bool append) +{ + if (pluginsLoaded) + throw UsageError("plugin-files set after plugins were loaded, you may need to move the flag before the subcommand"); + BaseSetting<Paths>::set(str, append); +} + + void initPlugins() { + assert(!settings.pluginFiles.pluginsLoaded); for (const auto & pluginFile : settings.pluginFiles.get()) { Paths pluginFiles; try { @@ -270,6 +279,9 @@ void initPlugins() unknown settings. */ globalConfig.reapplyUnknownSettings(); globalConfig.warnUnknownSettings(); + + /* Tell the user if they try to set plugin-files after we've already loaded */ + settings.pluginFiles.pluginsLoaded = true; } } |