diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-09-13 16:23:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 16:23:22 +0200 |
commit | 9a5a315aee615ae85959ee3cd76e1b8893282fbf (patch) | |
tree | d9a8cff0f1c0d4aa0ecf4d40fd214de7c8577934 /src/main.rs | |
parent | cfdc2eabfa31ef7e907a325e235dcac8cf748c36 (diff) |
Add `options` subcommand to `attach` (#718)
fixes #688
- the `options` subcommand of `attach` functions the same,
as the `options` subcommand of creating the normal session,
but not every option will have an effect on reattaching,
for example the `default_mode` setting would make no sense
to switch.
In the future it would make sense to be able to hot swap some
of the options on reattach, but we are not able to do that yet,
for example the `default_shell` one.
Eg:
```
zellij attach <session-name> options --theme <theme>
```
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index abf40aa83..294464504 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use std::process; use zellij_client::{os_input_output::get_client_os_input, start_client, ClientInfo}; use zellij_server::{os_input_output::get_server_os_input, start_server}; use zellij_utils::{ - cli::{CliArgs, Command, Sessions}, + cli::{CliArgs, Command, SessionCommand, Sessions}, consts::{ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR}, logging::*, setup::{get_default_data_dir, Setup}, @@ -54,6 +54,7 @@ pub fn main() { if let Some(Command::Sessions(Sessions::Attach { mut session_name, force, + options, })) = opts.command.clone() { if let Some(session) = session_name.as_ref() { @@ -62,10 +63,16 @@ pub fn main() { session_name = Some(get_active_session()); } + let config_options = match options { + Some(SessionCommand::Options(o)) => config_options.merge(o), + None => config_options, + }; + start_client( Box::new(os_input), opts, config, + config_options.clone(), ClientInfo::Attach(session_name.unwrap(), force, config_options), None, ); @@ -85,6 +92,7 @@ pub fn main() { Box::new(os_input), opts, config, + config_options, ClientInfo::New(session_name), layout, ); |