summaryrefslogtreecommitdiff
path: root/src/client.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-04-07 21:25:44 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-04-07 23:47:51 +0100
commit203a7732f5fafb5f9b7e8564bd3bd4587e168134 (patch)
treee136448924786ac638b8ad91304b6cdf6e5eb035 /src/client.cc
parent33de42610dc08dd7bfd65f49a70ec68a478dee2d (diff)
Add support for querying client environement variables
At connection, a remote client sends all its environement to the server, which then provides access to client env through kak_client_env_VAR_NAME variables in the shell.
Diffstat (limited to 'src/client.cc')
-rw-r--r--src/client.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/client.cc b/src/client.cc
index 4f8dfbdf..cda0ef5c 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -14,10 +14,13 @@ namespace Kakoune
Client::Client(std::unique_ptr<UserInterface>&& ui,
std::unique_ptr<Window>&& window,
- SelectionList selections, String name)
+ SelectionList selections,
+ EnvVarMap env_vars,
+ String name)
: m_ui{std::move(ui)}, m_window{std::move(window)},
m_input_handler{m_window->buffer(), std::move(selections),
- std::move(name)}
+ std::move(name)},
+ m_env_vars(env_vars)
{
context().set_client(*this);
context().set_window(*m_window);
@@ -151,4 +154,13 @@ void Client::check_buffer_fs_timestamp()
reload_buffer(context(), filename);
}
+const String& Client::get_env_var(const String& name) const
+{
+ auto it = m_env_vars.find(name);
+ static String empty{};
+ if (it == m_env_vars.end())
+ return empty;
+ return it->second;
+}
+
}