diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-02-10 10:42:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-10 10:42:46 +0100 |
| commit | 860e8e323a0d9b94280e1e25d0c626ff5bc03687 (patch) | |
| tree | 53b7bdccd075f93e93a7d93d8bb79878061aa000 /zellij-utils/assets/prost/api.plugin_command.rs | |
| parent | chore: Fix the issue template to match existing labels (#4637) (diff) | |
| download | sl0ppij-860e8e323a0d9b94280e1e25d0c626ff5bc03687.tar.gz sl0ppij-860e8e323a0d9b94280e1e25d0c626ff5bc03687.tar.xz sl0ppij-860e8e323a0d9b94280e1e25d0c626ff5bc03687.zip | |
Improve plugin API ergonomics and add CLI goodies (#4690)
* return created tab_id from relevant plugin API methods
* add to cli
* return Option<PaneId> in plugin API methods that create panes
* return created pane_id in cli for relevant actions
* allow plugins to query for pane_info based on pane_id
* allow plugins to query for TabInfo by its id
* allow plugins to query pane command/cwd synchronously
* zellij action list-panes
* style and formatting
* fix e2e tests
* add pr
Diffstat (limited to '')
| -rw-r--r-- | zellij-utils/assets/prost/api.plugin_command.rs | 293 |
1 files changed, 292 insertions, 1 deletions
diff --git a/zellij-utils/assets/prost/api.plugin_command.rs b/zellij-utils/assets/prost/api.plugin_command.rs index b586527a..2be64791 100644 --- a/zellij-utils/assets/prost/api.plugin_command.rs +++ b/zellij-utils/assets/prost/api.plugin_command.rs @@ -3,7 +3,7 @@ pub struct PluginCommand { #[prost(enumeration="CommandName", tag="1")] pub name: i32, - #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138")] + #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142")] pub payload: ::core::option::Option<plugin_command::Payload>, } /// Nested message and enum types in `PluginCommand`. @@ -259,6 +259,14 @@ pub mod plugin_command { SaveSessionPayload(super::SaveSessionPayload), #[prost(message, tag="138")] CurrentSessionLastSavedTimePayload(super::CurrentSessionLastSavedTimePayload), + #[prost(message, tag="139")] + GetPaneInfoPayload(super::GetPaneInfoPayload), + #[prost(message, tag="140")] + GetTabInfoPayload(super::GetTabInfoPayload), + #[prost(message, tag="141")] + GetPaneRunningCommandPayload(super::GetPaneRunningCommandPayload), + #[prost(message, tag="142")] + GetPaneCwdPayload(super::GetPaneCwdPayload), } } #[allow(clippy::derive_partial_eq_without_eq)] @@ -1024,6 +1032,58 @@ pub mod get_pane_pid_response { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneRunningCommandPayload { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneRunningCommandResponse { + #[prost(oneof="get_pane_running_command_response::Result", tags="1, 2")] + pub result: ::core::option::Option<get_pane_running_command_response::Result>, +} +/// Nested message and enum types in `GetPaneRunningCommandResponse`. +pub mod get_pane_running_command_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(message, tag="1")] + Command(super::RunningCommand), + #[prost(string, tag="2")] + Error(::prost::alloc::string::String), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunningCommand { + #[prost(string, repeated, tag="1")] + pub args: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneCwdPayload { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneCwdResponse { + #[prost(oneof="get_pane_cwd_response::Result", tags="1, 2")] + pub result: ::core::option::Option<get_pane_cwd_response::Result>, +} +/// Nested message and enum types in `GetPaneCwdResponse`. +pub mod get_pane_cwd_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(string, tag="1")] + Cwd(::prost::alloc::string::String), + #[prost(string, tag="2")] + Error(::prost::alloc::string::String), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct SaveLayoutResponse { #[prost(oneof="save_layout_response::Result", tags="1, 2")] pub result: ::core::option::Option<save_layout_response::Result>, @@ -1282,6 +1342,225 @@ pub struct CurrentSessionLastSavedTimeResponse { #[prost(uint64, optional, tag="1")] pub timestamp_millis: ::core::option::Option<u64>, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneInfoPayload { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetPaneInfoResponse { + /// None if pane not found + #[prost(message, optional, tag="1")] + pub pane_info: ::core::option::Option<super::event::PaneInfo>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTabInfoPayload { + #[prost(uint64, tag="1")] + pub tab_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTabInfoResponse { + /// None if tab not found + #[prost(message, optional, tag="1")] + pub tab_info: ::core::option::Option<super::event::TabInfo>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewTabResponse { + #[prost(oneof="new_tab_response::Result", tags="1, 2")] + pub result: ::core::option::Option<new_tab_response::Result>, +} +/// Nested message and enum types in `NewTabResponse`. +pub mod new_tab_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(uint64, tag="1")] + TabId(u64), + /// Indicates None + #[prost(bool, tag="2")] + None(bool), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewTabsResponse { + /// Only includes successfully created tabs + #[prost(uint64, repeated, tag="1")] + pub tab_ids: ::prost::alloc::vec::Vec<u64>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FocusOrCreateTabResponse { + #[prost(oneof="focus_or_create_tab_response::Result", tags="1, 2")] + pub result: ::core::option::Option<focus_or_create_tab_response::Result>, +} +/// Nested message and enum types in `FocusOrCreateTabResponse`. +pub mod focus_or_create_tab_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(uint64, tag="1")] + TabId(u64), + /// Indicates None + #[prost(bool, tag="2")] + None(bool), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BreakPanesToNewTabResponse { + #[prost(oneof="break_panes_to_new_tab_response::Result", tags="1, 2")] + pub result: ::core::option::Option<break_panes_to_new_tab_response::Result>, +} +/// Nested message and enum types in `BreakPanesToNewTabResponse`. +pub mod break_panes_to_new_tab_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(uint64, tag="1")] + TabId(u64), + /// Indicates None + #[prost(bool, tag="2")] + None(bool), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BreakPanesToTabWithIndexResponse { + #[prost(oneof="break_panes_to_tab_with_index_response::Result", tags="1, 2")] + pub result: ::core::option::Option<break_panes_to_tab_with_index_response::Result>, +} +/// Nested message and enum types in `BreakPanesToTabWithIndexResponse`. +pub mod break_panes_to_tab_with_index_response { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Result { + #[prost(uint64, tag="1")] + TabId(u64), + /// Indicates None + #[prost(bool, tag="2")] + None(bool), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileFloatingResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileInPlaceResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileFloatingNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFileInPlaceOfPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalFloatingResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalInPlaceResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalFloatingNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenTerminalInPlaceOfPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneFloatingResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneInPlaceResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneFloatingNearPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneInPlaceOfPluginResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenCommandPaneBackgroundResponse { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CommandName { @@ -1452,6 +1731,10 @@ pub enum CommandName { SetPaneBorderless = 185, SaveSession = 186, CurrentSessionLastSavedTime = 187, + GetPaneInfo = 188, + GetTabInfo = 189, + GetPaneRunningCommand = 190, + GetPaneCwd = 191, } impl CommandName { /// String value of the enum field names used in the ProtoBuf definition. @@ -1627,6 +1910,10 @@ impl CommandName { CommandName::SetPaneBorderless => "SetPaneBorderless", CommandName::SaveSession => "SaveSession", CommandName::CurrentSessionLastSavedTime => "CurrentSessionLastSavedTime", + CommandName::GetPaneInfo => "GetPaneInfo", + CommandName::GetTabInfo => "GetTabInfo", + CommandName::GetPaneRunningCommand => "GetPaneRunningCommand", + CommandName::GetPaneCwd => "GetPaneCwd", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1799,6 +2086,10 @@ impl CommandName { "SetPaneBorderless" => Some(Self::SetPaneBorderless), "SaveSession" => Some(Self::SaveSession), "CurrentSessionLastSavedTime" => Some(Self::CurrentSessionLastSavedTime), + "GetPaneInfo" => Some(Self::GetPaneInfo), + "GetTabInfo" => Some(Self::GetTabInfo), + "GetPaneRunningCommand" => Some(Self::GetPaneRunningCommand), + "GetPaneCwd" => Some(Self::GetPaneCwd), _ => None, } } |
