diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-03-27 20:24:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-27 20:24:18 +0100 |
| commit | 9d2e7fe2c19d2d61223dcc30787ea83a0e447781 (patch) | |
| tree | c077c4fdedb48d18c9e933c76ef8e97850d59bed /zellij-utils | |
| parent | docs(changelog): plugin serialization fix (diff) | |
| download | sl0ppij-9d2e7fe2c19d2d61223dcc30787ea83a0e447781.tar.gz sl0ppij-9d2e7fe2c19d2d61223dcc30787ea83a0e447781.tar.xz sl0ppij-9d2e7fe2c19d2d61223dcc30787ea83a0e447781.zip | |
feat(plugins): add api to close current plugin instance (#3228)
Diffstat (limited to 'zellij-utils')
| -rw-r--r-- | zellij-utils/assets/prost/api.plugin_command.rs | 3 | ||||
| -rw-r--r-- | zellij-utils/src/data.rs | 1 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.proto | 1 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 8 |
4 files changed, 13 insertions, 0 deletions
diff --git a/zellij-utils/assets/prost/api.plugin_command.rs b/zellij-utils/assets/prost/api.plugin_command.rs index ca067fd9..3bf49d36 100644 --- a/zellij-utils/assets/prost/api.plugin_command.rs +++ b/zellij-utils/assets/prost/api.plugin_command.rs @@ -421,6 +421,7 @@ pub enum CommandName { ScanHostFolder = 82, WatchFilesystem = 83, DumpSessionLayout = 84, + CloseSelf = 85, } impl CommandName { /// String value of the enum field names used in the ProtoBuf definition. @@ -514,6 +515,7 @@ impl CommandName { CommandName::ScanHostFolder => "ScanHostFolder", CommandName::WatchFilesystem => "WatchFilesystem", CommandName::DumpSessionLayout => "DumpSessionLayout", + CommandName::CloseSelf => "CloseSelf", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -604,6 +606,7 @@ impl CommandName { "ScanHostFolder" => Some(Self::ScanHostFolder), "WatchFilesystem" => Some(Self::WatchFilesystem), "DumpSessionLayout" => Some(Self::DumpSessionLayout), + "CloseSelf" => Some(Self::CloseSelf), _ => None, } } diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 78fbbd77..b0e0a886 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -1379,4 +1379,5 @@ pub enum PluginCommand { ScanHostFolder(PathBuf), // TODO: rename to ScanHostFolder WatchFilesystem, DumpSessionLayout, + CloseSelf, } diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto index b05c8ac8..b961593e 100644 --- a/zellij-utils/src/plugin_api/plugin_command.proto +++ b/zellij-utils/src/plugin_api/plugin_command.proto @@ -96,6 +96,7 @@ enum CommandName { ScanHostFolder = 82; WatchFilesystem = 83; DumpSessionLayout = 84; + CloseSelf = 85; } message PluginCommand { diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 232a9f2d..080dd9e2 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -871,6 +871,10 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { Some(_) => Err("DumpSessionLayout should have no payload, found a payload"), None => Ok(PluginCommand::DumpSessionLayout), }, + Some(CommandName::CloseSelf) => match protobuf_plugin_command.payload { + Some(_) => Err("CloseSelf should have no payload, found a payload"), + None => Ok(PluginCommand::CloseSelf), + }, None => Err("Unrecognized plugin command"), } } @@ -1389,6 +1393,10 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { name: CommandName::DumpSessionLayout as i32, payload: None, }), + PluginCommand::CloseSelf => Ok(ProtobufPluginCommand { + name: CommandName::CloseSelf as i32, + payload: None, + }), } } } |
