24f6471431
'$' pipes each selections through a given shell command, and only keeps the one that have an exit code of 0 Fixes #36
40 lines
942 B
C++
40 lines
942 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);
|
|
|
|
private:
|
|
std::vector<std::pair<Regex, EnvVarRetriever>> m_env_vars;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // shell_manager_hh_INCLUDED
|
|
|