diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-08-23 13:22:23 +0700 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-08-23 13:33:13 +0700 |
| commit | f7bed9eb183def6ad1e96df96c13fd22551fbf42 (patch) | |
| tree | c7d6badd4c15c415bc2b81b179ee7a856bb259bb /src/client.hh | |
| parent | 3efc406d571d651ed44b751eb798cc79a990c614 (diff) | |
Support specifying an exit status on `quit` commands
The current client exit status can be specified as an optional
parameter, is nothing is given the exit status will be 0.
Fixes #1230
Diffstat (limited to 'src/client.hh')
| -rw-r--r-- | src/client.hh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client.hh b/src/client.hh index daf8aa02..d870871b 100644 --- a/src/client.hh +++ b/src/client.hh @@ -21,15 +21,17 @@ enum class EventMode; enum class InfoStyle; enum class MenuStyle; - class Client : public SafeCountable, public OptionManagerWatcher { public: + using OnExitCallback = std::function<void (int status)>; + Client(std::unique_ptr<UserInterface>&& ui, std::unique_ptr<Window>&& window, SelectionList selections, EnvVarMap env_vars, - String name); + String name, + OnExitCallback on_exit); ~Client(); Client(Client&&) = delete; @@ -65,6 +67,8 @@ public: Buffer* last_buffer() const { return m_last_buffer.get(); } void set_last_buffer(Buffer* last_buffer) { m_last_buffer = last_buffer; } + void exit(int status) { m_on_exit(status); } + private: void on_option_changed(const Option& option) override; @@ -79,6 +83,8 @@ private: std::unique_ptr<UserInterface> m_ui; std::unique_ptr<Window> m_window; + OnExitCallback m_on_exit; + EnvVarMap m_env_vars; InputHandler m_input_handler; |
