summaryrefslogtreecommitdiff
path: root/src/shell_manager.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-06-25 19:40:18 +0200
committerMaxime Coste <frrrwww@gmail.com>2012-06-25 19:40:18 +0200
commit7fb49b183ea5caa645b76055d5531846b52f487b (patch)
tree0f7553417071a36c0f7ab78fd16c29ab74df5b5f /src/shell_manager.hh
parentcffb895797998f18bbf80c1f1e67c44f511c51cf (diff)
ShellManager environment variable use a regex instead of an exact match
when a kakoune releated env var used in a shell command, the ShellManager tries to match it with given regex and the first that matches calls its value retriever. For this to be useful, EnvVarRetrievers now also take the variable name in its parameters.
Diffstat (limited to 'src/shell_manager.hh')
-rw-r--r--src/shell_manager.hh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/shell_manager.hh b/src/shell_manager.hh
index 0b22da5c..37d47b32 100644
--- a/src/shell_manager.hh
+++ b/src/shell_manager.hh
@@ -10,7 +10,7 @@ namespace Kakoune
{
class Context;
-typedef std::function<String (const Context&)> EnvVarRetriever;
+typedef std::function<String (const String& name, const Context&)> EnvVarRetriever;
typedef std::unordered_map<String, String> EnvVarMap;
class ShellManager : public Singleton<ShellManager>
@@ -25,11 +25,11 @@ public:
const String& cmdline, const Context& context,
const EnvVarMap& env_vars);
- void register_env_var(const String& name, EnvVarRetriever retriever);
+ void register_env_var(const String& regex, EnvVarRetriever retriever);
private:
- Regex m_regex;
- std::unordered_map<String, EnvVarRetriever> m_env_vars;
+ Regex m_regex;
+ std::vector<std::pair<Regex, EnvVarRetriever>> m_env_vars;
};
}