2012-05-03 11:25:13 +04:00
|
|
|
#ifndef shell_manager_hh_INCLUDED
|
|
|
|
#define shell_manager_hh_INCLUDED
|
|
|
|
|
2014-10-13 16:12:33 +04:00
|
|
|
#include "regex.hh"
|
2013-04-09 22:05:40 +04:00
|
|
|
#include "utils.hh"
|
2014-04-08 00:25:44 +04:00
|
|
|
#include "env_vars.hh"
|
2012-05-03 11:25:13 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2014-01-28 00:28:38 +04:00
|
|
|
class Context;
|
2015-01-06 16:40:56 +03:00
|
|
|
template<typename T> class ArrayView;
|
2014-11-13 00:27:07 +03:00
|
|
|
class String;
|
|
|
|
class StringView;
|
|
|
|
|
2014-04-20 15:15:31 +04:00
|
|
|
using EnvVarRetriever = std::function<String (StringView name, const Context&)>;
|
2012-05-03 11:25:13 +04:00
|
|
|
|
|
|
|
class ShellManager : public Singleton<ShellManager>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShellManager();
|
|
|
|
|
2014-04-20 15:15:31 +04:00
|
|
|
String eval(StringView cmdline, const Context& context,
|
2015-01-06 16:40:56 +03:00
|
|
|
ArrayView<String> params,
|
2014-05-05 21:00:24 +04:00
|
|
|
const EnvVarMap& env_vars,
|
|
|
|
int* exit_status = nullptr);
|
2012-05-03 11:25:13 +04:00
|
|
|
|
2014-04-20 15:15:31 +04:00
|
|
|
String pipe(StringView input,
|
|
|
|
StringView cmdline, const Context& context,
|
2015-01-06 16:40:56 +03:00
|
|
|
ArrayView<String> params,
|
2014-05-05 21:00:24 +04:00
|
|
|
const EnvVarMap& env_vars,
|
|
|
|
int* exit_status = nullptr);
|
2012-05-29 14:39:03 +04:00
|
|
|
|
2014-04-20 15:15:31 +04:00
|
|
|
void register_env_var(StringView regex, EnvVarRetriever retriever);
|
2014-06-18 22:28:48 +04:00
|
|
|
String get_val(StringView name, const Context& context) const;
|
2012-05-03 11:25:13 +04:00
|
|
|
|
|
|
|
private:
|
2015-01-12 16:58:41 +03:00
|
|
|
Vector<std::pair<Regex, EnvVarRetriever>> m_env_vars;
|
2012-05-03 11:25:13 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // shell_manager_hh_INCLUDED
|