1
1
mirror of https://github.com/mawww/kakoune.git synced 2025-01-05 10:30:41 +03:00
kakoune/src/shell_manager.hh
Maxime Coste 9aa8c8a60a Add a %val{...} expand type
%val{name} gives access to values given in shell through $kak_<name>
2014-06-18 19:32:13 +01:00

41 lines
1009 B
C++

#ifndef shell_manager_hh_INCLUDED
#define shell_manager_hh_INCLUDED
#include "string.hh"
#include "utils.hh"
#include "env_vars.hh"
namespace Kakoune
{
class Context;
using EnvVarRetriever = std::function<String (StringView name, const Context&)>;
class ShellManager : public Singleton<ShellManager>
{
public:
ShellManager();
String eval(StringView cmdline, const Context& context,
memoryview<String> params,
const EnvVarMap& env_vars,
int* exit_status = nullptr);
String pipe(StringView input,
StringView cmdline, const Context& context,
memoryview<String> params,
const EnvVarMap& env_vars,
int* exit_status = nullptr);
void register_env_var(StringView regex, EnvVarRetriever retriever);
String get_val(StringView name, const Context& context) const;
private:
std::vector<std::pair<Regex, EnvVarRetriever>> m_env_vars;
};
}
#endif // shell_manager_hh_INCLUDED