From 6207734b6b54cba14c8aac77d10bf3517f0157cb Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Tue, 30 Apr 2024 14:22:42 +0200 Subject: [PATCH 1/2] feat(cli): list clients --- zellij-server/src/plugins/mod.rs | 9 +++ zellij-server/src/pty.rs | 12 +++ zellij-server/src/route.rs | 9 +++ zellij-server/src/screen.rs | 33 +++++++- zellij-server/src/session_layout_metadata.rs | 80 +++++++++++++++++++- zellij-utils/src/cli.rs | 1 + zellij-utils/src/errors.rs | 3 + zellij-utils/src/input/actions.rs | 4 + zellij-utils/src/plugin_api/action.rs | 1 + zellij-utils/src/session_serialization.rs | 6 +- 10 files changed, 149 insertions(+), 9 deletions(-) diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index f6862ffd55..6beec9c6a2 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -105,6 +105,7 @@ pub enum PluginInstruction { Option, ), DumpLayout(SessionLayoutMetadata, ClientId), + ListClientsMetadata(SessionLayoutMetadata, ClientId), DumpLayoutToPlugin(SessionLayoutMetadata, PluginId), LogLayoutToHd(SessionLayoutMetadata), CliPipe { @@ -173,6 +174,7 @@ impl From<&PluginInstruction> for PluginContext { PluginContext::PermissionRequestResult }, PluginInstruction::DumpLayout(..) => PluginContext::DumpLayout, + PluginInstruction::ListClientsMetadata(..) => PluginContext::ListClientsMetadata, PluginInstruction::LogLayoutToHd(..) => PluginContext::LogLayoutToHd, PluginInstruction::CliPipe { .. } => PluginContext::CliPipe, PluginInstruction::CachePluginEvents { .. } => PluginContext::CachePluginEvents, @@ -489,6 +491,13 @@ pub(crate) fn plugin_thread_main( client_id, ))); }, + PluginInstruction::ListClientsMetadata(mut session_layout_metadata, client_id) => { + populate_session_layout_metadata(&mut session_layout_metadata, &wasm_bridge); + drop(bus.senders.send_to_pty(PtyInstruction::ListClientsMetadata( + session_layout_metadata, + client_id, + ))); + }, PluginInstruction::DumpLayoutToPlugin(mut session_layout_metadata, plugin_id) => { populate_session_layout_metadata(&mut session_layout_metadata, &wasm_bridge); match session_serialization::serialize_session_layout( diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 5877e56dfa..74ea1cf0df 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -92,6 +92,7 @@ pub enum PtyInstruction { Option, // if Some, will not fill cwd but just forward the message Option, ), + ListClientsMetadata(SessionLayoutMetadata, ClientId), Exit, } @@ -114,6 +115,7 @@ impl From<&PtyInstruction> for PtyContext { PtyInstruction::DumpLayoutToPlugin(..) => PtyContext::DumpLayoutToPlugin, PtyInstruction::LogLayoutToHd(..) => PtyContext::LogLayoutToHd, PtyInstruction::FillPluginCwd(..) => PtyContext::FillPluginCwd, + PtyInstruction::ListClientsMetadata(..) => PtyContext::ListClientsMetadata, PtyInstruction::Exit => PtyContext::Exit, } } @@ -632,6 +634,15 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { }, } }, + PtyInstruction::ListClientsMetadata(mut session_layout_metadata, client_id) => { + let err_context = || format!("Failed to dump layout"); + pty.populate_session_layout_metadata(&mut session_layout_metadata); + pty.bus + .senders + .send_to_server(ServerInstruction::Log(vec![format!("{}", session_layout_metadata.list_clients_metadata())], client_id)) + .with_context(err_context) + .non_fatal(); + }, PtyInstruction::DumpLayoutToPlugin(mut session_layout_metadata, plugin_id) => { let err_context = || format!("Failed to dump layout"); pty.populate_session_layout_metadata(&mut session_layout_metadata); @@ -1342,6 +1353,7 @@ impl Pty { session_layout_metadata.update_default_shell(get_default_shell()); session_layout_metadata.update_terminal_commands(terminal_ids_to_commands); session_layout_metadata.update_terminal_cwds(terminal_ids_to_cwds); + session_layout_metadata.update_default_editor(&self.default_editor) } pub fn fill_plugin_cwd( &self, diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index fef5b75423..394d214d02 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -926,6 +926,15 @@ pub(crate) fn route_action( log::error!("Message must have a name"); } }, + Action::ListClients => { + let default_shell = match default_shell { + Some(TerminalAction::RunCommand(run_command)) => Some(run_command.command), + _ => None, + }; + senders + .send_to_screen(ScreenInstruction::ListClientsMetadata(default_shell, client_id)) + .with_context(err_context)?; + }, } Ok(should_break) } diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index cd471652f1..d2b2848d04 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -358,6 +358,7 @@ pub enum ScreenInstruction { ), DumpLayoutToHd, RenameSession(String, ClientId), // String -> new name + ListClientsMetadata(Option, ClientId), // Option - default shell } impl From<&ScreenInstruction> for ScreenContext { @@ -541,6 +542,7 @@ impl From<&ScreenInstruction> for ScreenContext { ScreenInstruction::NewInPlacePluginPane(..) => ScreenContext::NewInPlacePluginPane, ScreenInstruction::DumpLayoutToHd => ScreenContext::DumpLayoutToHd, ScreenInstruction::RenameSession(..) => ScreenContext::RenameSession, + ScreenInstruction::ListClientsMetadata(..) => ScreenContext::ListClientsMetadata, } } } @@ -2165,8 +2167,15 @@ impl Screen { for (triggering_pane_id, p) in tab.get_suppressed_panes() { suppressed_panes.insert(*triggering_pane_id, p); } - let active_pane_id = - first_client_id.and_then(|client_id| tab.get_active_pane_id(client_id)); + + let all_connected_clients: Vec = + self.connected_clients.borrow().iter().copied().filter(|c| self.active_tab_indices.get(&c) == Some(&tab_index)).collect(); + + let mut active_pane_ids: HashMap> = HashMap::new(); + for connected_client_id in &all_connected_clients { + active_pane_ids.insert(*connected_client_id, tab.get_active_pane_id(*connected_client_id)); + } + let tiled_panes: Vec = tab .get_tiled_panes() .map(|(pane_id, p)| { @@ -2183,18 +2192,20 @@ impl Screen { } }) .map(|(pane_id, p)| { + let focused_clients: Vec = active_pane_ids.iter().filter_map(|(c_id, p_id)| p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None })).collect(); PaneLayoutMetadata::new( pane_id, p.position_and_size(), p.borderless(), p.invoked_with().clone(), p.custom_title(), - active_pane_id == Some(pane_id), + !focused_clients.is_empty(), if self.serialize_pane_viewport { p.serialize(self.scrollback_lines_to_serialize) } else { None }, + focused_clients ) }) .collect(); @@ -2214,18 +2225,20 @@ impl Screen { } }) .map(|(pane_id, p)| { + let focused_clients: Vec = active_pane_ids.iter().filter_map(|(c_id, p_id)| p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None })).collect(); PaneLayoutMetadata::new( pane_id, p.position_and_size(), false, // floating panes are never borderless p.invoked_with().clone(), p.custom_title(), - active_pane_id == Some(pane_id), + !focused_clients.is_empty(), if self.serialize_pane_viewport { p.serialize(self.scrollback_lines_to_serialize) } else { None }, + focused_clients, ) }) .collect(); @@ -2660,6 +2673,18 @@ pub(crate) fn screen_thread_main( )) .with_context(err_context)?; }, + ScreenInstruction::ListClientsMetadata(default_shell, client_id) => { + let err_context = || format!("Failed to dump layout"); + let session_layout_metadata = screen.get_layout_metadata(default_shell); + screen + .bus + .senders + .send_to_plugin(PluginInstruction::ListClientsMetadata( + session_layout_metadata, + client_id, + )) + .with_context(err_context)?; + }, ScreenInstruction::DumpLayoutToPlugin(plugin_id) => { let err_context = || format!("Failed to dump layout"); let session_layout_metadata = diff --git a/zellij-server/src/session_layout_metadata.rs b/zellij-server/src/session_layout_metadata.rs index da19bc9086..7c2716454c 100644 --- a/zellij-server/src/session_layout_metadata.rs +++ b/zellij-server/src/session_layout_metadata.rs @@ -1,12 +1,13 @@ +use crate::ClientId; use crate::panes::PaneId; -use std::collections::HashMap; +use std::collections::{HashMap, BTreeMap}; use std::path::PathBuf; use zellij_utils::common_path::common_path_all; use zellij_utils::pane_size::PaneGeom; use zellij_utils::{ input::command::RunCommand, input::layout::{Layout, Run, RunPlugin, RunPluginOrAlias}, - session_serialization::{GlobalLayoutManifest, PaneLayoutManifest, TabLayoutManifest}, + session_serialization::{GlobalLayoutManifest, PaneLayoutManifest, TabLayoutManifest, extract_command_and_args, extract_plugin_and_config, extract_edit_and_line_number}, }; #[derive(Default, Debug, Clone)] @@ -14,6 +15,7 @@ pub struct SessionLayoutMetadata { default_layout: Box, global_cwd: Option, pub default_shell: Option, + pub default_editor: Option, tabs: Vec, } @@ -53,6 +55,23 @@ impl SessionLayoutMetadata { } } } + pub fn list_clients_metadata(&self) -> String { + let mut clients_metadata: BTreeMap = BTreeMap::new(); + for tab in &self.tabs { + let panes = if tab.hide_floating_panes { &tab.tiled_panes } else { &tab.floating_panes }; + for pane in panes { + for focused_client in &pane.focused_clients { + clients_metadata.insert(*focused_client, ClientMetadata { + pane_id: pane.id.clone(), + command: pane.run.clone(), + }); + } + } + + } + + ClientMetadata::render_many(clients_metadata, &self.default_editor) + } fn is_default_shell( default_shell: Option<&PathBuf>, command_name: &String, @@ -192,6 +211,15 @@ impl SessionLayoutMetadata { } } } + pub fn update_default_editor(&mut self, default_editor: &Option) { + let default_editor = default_editor.clone().unwrap_or_else(|| { + PathBuf::from( + std::env::var("EDITOR") + .unwrap_or_else(|_| std::env::var("VISUAL").unwrap_or_else(|_| "vi".into())), + ) + }); + self.default_editor = Some(default_editor); + } } impl Into for SessionLayoutMetadata { @@ -253,6 +281,7 @@ pub struct PaneLayoutMetadata { title: Option, is_focused: bool, pane_contents: Option, + focused_clients: Vec, } impl PaneLayoutMetadata { @@ -264,6 +293,7 @@ impl PaneLayoutMetadata { title: Option, is_focused: bool, pane_contents: Option, + focused_clients: Vec, ) -> Self { PaneLayoutMetadata { id, @@ -274,6 +304,52 @@ impl PaneLayoutMetadata { title, is_focused, pane_contents, + focused_clients, + } + } +} + +struct ClientMetadata { + pane_id: PaneId, + command: Option +} +impl ClientMetadata { + pub fn stringify_pane_id(&self) -> String { + match self.pane_id { + PaneId::Terminal(terminal_id) => format!("terminal_{}", terminal_id), + PaneId::Plugin(plugin_id) => format!("plugin_{}", plugin_id), + } + } + pub fn stringify_command(&self, editor: &Option) -> String { + let stringified = match &self.command { + Some(Run::Command(..)) => { + let (command, args) = extract_command_and_args(&self.command); + command.map(|c| format!("{} {}", c, args.join(" "))) + } + Some(Run::EditFile(..)) => { + let (file_to_edit, _line_number) = extract_edit_and_line_number(&self.command); + editor + .as_ref() + .and_then(|editor| file_to_edit + .map(|file_to_edit| format!("{} {}", editor.display(), file_to_edit)) + ) + } + Some(Run::Plugin(..)) => { + let (plugin, _plugin_config) = extract_plugin_and_config(&self.command); + plugin.map(|p| format!("{}", p)) + } + _ => None, + }; + stringified.unwrap_or("N/A".to_owned()) + } + pub fn render_many(clients_metadata: BTreeMap, default_editor: &Option) -> String { + let mut lines = vec![]; + lines.push(String::from("CLIENT_ID ZELLIJ_PANE_ID RUNNING_COMMAND")); + + for (client_id, client_metadata) in clients_metadata.iter() { + // 9 - CLIENT_ID, 14 - ZELLIJ_PANE_ID, 15 - RUNNING_COMMAND + lines.push(format!("{} {} {}", format!("{0: <9}", client_id), format!("{0: <14}", client_metadata.stringify_pane_id()), format!("{0: <15}", client_metadata.stringify_command(default_editor)))); } + lines.join("\n") } } diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index 162a23e9e7..f3c622dcbb 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -736,4 +736,5 @@ tail -f /tmp/my-live-logfile | zellij action pipe --name logs --plugin https://e #[clap(short('t'), long, value_parser, display_order(10))] plugin_title: Option, }, + ListClients, } diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs index 51174b7566..248ff9be0a 100644 --- a/zellij-utils/src/errors.rs +++ b/zellij-utils/src/errors.rs @@ -352,6 +352,7 @@ pub enum ScreenContext { DumpLayoutToHd, RenameSession, DumpLayoutToPlugin, + ListClientsMetadata, } /// Stack call representations corresponding to the different types of [`PtyInstruction`]s. @@ -373,6 +374,7 @@ pub enum PtyContext { LogLayoutToHd, FillPluginCwd, DumpLayoutToPlugin, + ListClientsMetadata, Exit, } @@ -405,6 +407,7 @@ pub enum PluginContext { WatchFilesystem, KeybindPipe, DumpLayoutToPlugin, + ListClientsMetadata, } /// Stack call representations corresponding to the different types of [`ClientInstruction`]s. diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index 52c18fb509..c988bcbae1 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -297,6 +297,7 @@ pub enum Action { cwd: Option, pane_title: Option, }, + ListClients, } impl Action { @@ -689,6 +690,9 @@ impl Action { skip_cache, }]) }, + CliAction::ListClients => { + Ok(vec![Action::ListClients]) + } } } } diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs index 14d5ad090b..9262541a43 100644 --- a/zellij-utils/src/plugin_api/action.rs +++ b/zellij-utils/src/plugin_api/action.rs @@ -1293,6 +1293,7 @@ impl TryFrom for ProtobufAction { | Action::Copy | Action::DumpLayout | Action::CliPipe { .. } + | Action::ListClients | Action::SkipConfirm(..) => Err("Unsupported action"), } } diff --git a/zellij-utils/src/session_serialization.rs b/zellij-utils/src/session_serialization.rs index d34aeb1466..78900c0395 100644 --- a/zellij-utils/src/session_serialization.rs +++ b/zellij-utils/src/session_serialization.rs @@ -216,7 +216,7 @@ fn kdl_string_from_tiled_pane( kdl_string } -fn extract_command_and_args(layout_run: &Option) -> (Option, Vec) { +pub fn extract_command_and_args(layout_run: &Option) -> (Option, Vec) { match layout_run { Some(Run::Command(run_command)) => ( Some(run_command.command.display().to_string()), @@ -225,7 +225,7 @@ fn extract_command_and_args(layout_run: &Option) -> (Option, Vec (None, vec![]), } } -fn extract_plugin_and_config( +pub fn extract_plugin_and_config( layout_run: &Option, ) -> (Option, Option) { match &layout_run { @@ -246,7 +246,7 @@ fn extract_plugin_and_config( _ => (None, None), } } -fn extract_edit_and_line_number(layout_run: &Option) -> (Option, Option) { +pub fn extract_edit_and_line_number(layout_run: &Option) -> (Option, Option) { match &layout_run { // TODO: line number in layouts? Some(Run::EditFile(path, line_number, _cwd)) => { From 2133f3aeab7c9519018be9d763865b9dbe0252e2 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Tue, 30 Apr 2024 14:54:42 +0200 Subject: [PATCH 2/2] style(fmt): rustfmt --- zellij-server/src/pty.rs | 8 ++- zellij-server/src/route.rs | 5 +- zellij-server/src/screen.rs | 30 ++++++++--- zellij-server/src/session_layout_metadata.rs | 57 +++++++++++++------- zellij-utils/src/input/actions.rs | 4 +- 5 files changed, 74 insertions(+), 30 deletions(-) diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 74ea1cf0df..f8bd61d221 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -639,7 +639,13 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { pty.populate_session_layout_metadata(&mut session_layout_metadata); pty.bus .senders - .send_to_server(ServerInstruction::Log(vec![format!("{}", session_layout_metadata.list_clients_metadata())], client_id)) + .send_to_server(ServerInstruction::Log( + vec![format!( + "{}", + session_layout_metadata.list_clients_metadata() + )], + client_id, + )) .with_context(err_context) .non_fatal(); }, diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 394d214d02..fc50fd2c58 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -932,7 +932,10 @@ pub(crate) fn route_action( _ => None, }; senders - .send_to_screen(ScreenInstruction::ListClientsMetadata(default_shell, client_id)) + .send_to_screen(ScreenInstruction::ListClientsMetadata( + default_shell, + client_id, + )) .with_context(err_context)?; }, } diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index d2b2848d04..75d3456260 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -2168,12 +2168,20 @@ impl Screen { suppressed_panes.insert(*triggering_pane_id, p); } - let all_connected_clients: Vec = - self.connected_clients.borrow().iter().copied().filter(|c| self.active_tab_indices.get(&c) == Some(&tab_index)).collect(); + let all_connected_clients: Vec = self + .connected_clients + .borrow() + .iter() + .copied() + .filter(|c| self.active_tab_indices.get(&c) == Some(&tab_index)) + .collect(); let mut active_pane_ids: HashMap> = HashMap::new(); for connected_client_id in &all_connected_clients { - active_pane_ids.insert(*connected_client_id, tab.get_active_pane_id(*connected_client_id)); + active_pane_ids.insert( + *connected_client_id, + tab.get_active_pane_id(*connected_client_id), + ); } let tiled_panes: Vec = tab @@ -2192,7 +2200,12 @@ impl Screen { } }) .map(|(pane_id, p)| { - let focused_clients: Vec = active_pane_ids.iter().filter_map(|(c_id, p_id)| p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None })).collect(); + let focused_clients: Vec = active_pane_ids + .iter() + .filter_map(|(c_id, p_id)| { + p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None }) + }) + .collect(); PaneLayoutMetadata::new( pane_id, p.position_and_size(), @@ -2205,7 +2218,7 @@ impl Screen { } else { None }, - focused_clients + focused_clients, ) }) .collect(); @@ -2225,7 +2238,12 @@ impl Screen { } }) .map(|(pane_id, p)| { - let focused_clients: Vec = active_pane_ids.iter().filter_map(|(c_id, p_id)| p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None })).collect(); + let focused_clients: Vec = active_pane_ids + .iter() + .filter_map(|(c_id, p_id)| { + p_id.and_then(|p_id| if p_id == pane_id { Some(*c_id) } else { None }) + }) + .collect(); PaneLayoutMetadata::new( pane_id, p.position_and_size(), diff --git a/zellij-server/src/session_layout_metadata.rs b/zellij-server/src/session_layout_metadata.rs index 7c2716454c..0ca25804ee 100644 --- a/zellij-server/src/session_layout_metadata.rs +++ b/zellij-server/src/session_layout_metadata.rs @@ -1,13 +1,16 @@ -use crate::ClientId; use crate::panes::PaneId; -use std::collections::{HashMap, BTreeMap}; +use crate::ClientId; +use std::collections::{BTreeMap, HashMap}; use std::path::PathBuf; use zellij_utils::common_path::common_path_all; use zellij_utils::pane_size::PaneGeom; use zellij_utils::{ input::command::RunCommand, input::layout::{Layout, Run, RunPlugin, RunPluginOrAlias}, - session_serialization::{GlobalLayoutManifest, PaneLayoutManifest, TabLayoutManifest, extract_command_and_args, extract_plugin_and_config, extract_edit_and_line_number}, + session_serialization::{ + extract_command_and_args, extract_edit_and_line_number, extract_plugin_and_config, + GlobalLayoutManifest, PaneLayoutManifest, TabLayoutManifest, + }, }; #[derive(Default, Debug, Clone)] @@ -58,16 +61,22 @@ impl SessionLayoutMetadata { pub fn list_clients_metadata(&self) -> String { let mut clients_metadata: BTreeMap = BTreeMap::new(); for tab in &self.tabs { - let panes = if tab.hide_floating_panes { &tab.tiled_panes } else { &tab.floating_panes }; + let panes = if tab.hide_floating_panes { + &tab.tiled_panes + } else { + &tab.floating_panes + }; for pane in panes { for focused_client in &pane.focused_clients { - clients_metadata.insert(*focused_client, ClientMetadata { - pane_id: pane.id.clone(), - command: pane.run.clone(), - }); + clients_metadata.insert( + *focused_client, + ClientMetadata { + pane_id: pane.id.clone(), + command: pane.run.clone(), + }, + ); } } - } ClientMetadata::render_many(clients_metadata, &self.default_editor) @@ -311,7 +320,7 @@ impl PaneLayoutMetadata { struct ClientMetadata { pane_id: PaneId, - command: Option + command: Option, } impl ClientMetadata { pub fn stringify_pane_id(&self) -> String { @@ -325,30 +334,40 @@ impl ClientMetadata { Some(Run::Command(..)) => { let (command, args) = extract_command_and_args(&self.command); command.map(|c| format!("{} {}", c, args.join(" "))) - } + }, Some(Run::EditFile(..)) => { let (file_to_edit, _line_number) = extract_edit_and_line_number(&self.command); - editor - .as_ref() - .and_then(|editor| file_to_edit + editor.as_ref().and_then(|editor| { + file_to_edit .map(|file_to_edit| format!("{} {}", editor.display(), file_to_edit)) - ) - } + }) + }, Some(Run::Plugin(..)) => { let (plugin, _plugin_config) = extract_plugin_and_config(&self.command); plugin.map(|p| format!("{}", p)) - } + }, _ => None, }; stringified.unwrap_or("N/A".to_owned()) } - pub fn render_many(clients_metadata: BTreeMap, default_editor: &Option) -> String { + pub fn render_many( + clients_metadata: BTreeMap, + default_editor: &Option, + ) -> String { let mut lines = vec![]; lines.push(String::from("CLIENT_ID ZELLIJ_PANE_ID RUNNING_COMMAND")); for (client_id, client_metadata) in clients_metadata.iter() { // 9 - CLIENT_ID, 14 - ZELLIJ_PANE_ID, 15 - RUNNING_COMMAND - lines.push(format!("{} {} {}", format!("{0: <9}", client_id), format!("{0: <14}", client_metadata.stringify_pane_id()), format!("{0: <15}", client_metadata.stringify_command(default_editor)))); + lines.push(format!( + "{} {} {}", + format!("{0: <9}", client_id), + format!("{0: <14}", client_metadata.stringify_pane_id()), + format!( + "{0: <15}", + client_metadata.stringify_command(default_editor) + ) + )); } lines.join("\n") } diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index c988bcbae1..e36ca763b2 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -690,9 +690,7 @@ impl Action { skip_cache, }]) }, - CliAction::ListClients => { - Ok(vec![Action::ListClients]) - } + CliAction::ListClients => Ok(vec![Action::ListClients]), } } }