2012-05-03 09:25:13 +02:00
|
|
|
#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;
|
2012-05-29 07:19:27 +02:00
|
|
|
typedef std::unordered_map<String, String> EnvVarMap;
|
2012-05-03 09:25:13 +02:00
|
|
|
|
|
|
|
class ShellManager : public Singleton<ShellManager>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShellManager();
|
|
|
|
|
2012-05-29 07:19:27 +02:00
|
|
|
String eval(const String& cmdline, const Context& context,
|
|
|
|
const EnvVarMap& env_vars);
|
2012-05-03 09:25:13 +02:00
|
|
|
|
2012-05-29 12:39:03 +02:00
|
|
|
String pipe(const String& input,
|
|
|
|
const String& cmdline, const Context& context,
|
|
|
|
const EnvVarMap& env_vars);
|
|
|
|
|
2012-05-03 09:25:13 +02:00
|
|
|
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
|
|
|
|
|