2012-05-03 09:25:13 +02:00
|
|
|
#ifndef shell_manager_hh_INCLUDED
|
|
|
|
#define shell_manager_hh_INCLUDED
|
|
|
|
|
2012-08-29 21:49:36 +02:00
|
|
|
#include "string.hh"
|
2013-04-09 20:05:40 +02:00
|
|
|
#include "utils.hh"
|
2012-05-03 09:25:13 +02:00
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2013-02-18 14:00:43 +01:00
|
|
|
struct Context;
|
2014-01-09 20:50:01 +01:00
|
|
|
using EnvVarRetriever = std::function<String (const String& name, const Context&)>;
|
|
|
|
using EnvVarMap = std::unordered_map<String, String>;
|
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,
|
2013-07-26 01:17:12 +02:00
|
|
|
memoryview<String> params,
|
2012-05-29 07:19:27 +02:00
|
|
|
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,
|
2013-07-26 01:17:12 +02:00
|
|
|
memoryview<String> params,
|
2012-05-29 12:39:03 +02:00
|
|
|
const EnvVarMap& env_vars);
|
|
|
|
|
2012-06-25 19:40:18 +02:00
|
|
|
void register_env_var(const String& regex, EnvVarRetriever retriever);
|
2012-05-03 09:25:13 +02:00
|
|
|
|
|
|
|
private:
|
2012-06-25 19:40:18 +02:00
|
|
|
std::vector<std::pair<Regex, EnvVarRetriever>> m_env_vars;
|
2012-05-03 09:25:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // shell_manager_hh_INCLUDED
|
|
|
|
|