summaryrefslogtreecommitdiff
path: root/src/shell_manager.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-05-03 07:25:13 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-05-03 07:25:13 +0000
commit0c596a9d6424a2e3aa118780e739ed6a09acbec2 (patch)
tree8912ec38926bc2228c38fe44fe724f3da2e36038 /src/shell_manager.hh
parent2a291e6868f43ffe0f2068f51b12bbea3152eb55 (diff)
Add a ShellManager which handles executing shell commands
ShellManager provides shell commands with environement variable to retrieve some internal values in the shell parameters.
Diffstat (limited to 'src/shell_manager.hh')
-rw-r--r--src/shell_manager.hh32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/shell_manager.hh b/src/shell_manager.hh
new file mode 100644
index 00000000..b67136aa
--- /dev/null
+++ b/src/shell_manager.hh
@@ -0,0 +1,32 @@
+#ifndef shell_manager_hh_INCLUDED
+#define shell_manager_hh_INCLUDED
+
+#include "utils.hh"
+#include "regex.hh"
+
+#include <unordered_map>
+
+namespace Kakoune
+{
+
+class Context;
+typedef std::function<String (const Context&)> EnvVarRetriever;
+
+class ShellManager : public Singleton<ShellManager>
+{
+public:
+ ShellManager();
+
+ String eval(const String& cmdline, const Context& context);
+
+ void register_env_var(const String& name, EnvVarRetriever retriever);
+
+private:
+ Regex m_regex;
+ std::unordered_map<String, EnvVarRetriever> m_env_vars;
+};
+
+}
+
+#endif // shell_manager_hh_INCLUDED
+