diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-11-10 14:16:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:16:02 +0100 |
commit | 3b4a355f0d6e4e73874fd7081f7d467e8b4220ba (patch) | |
tree | 488b97ae8dddecc5b54a2065de462af8636b642c /zellij-utils | |
parent | e55cd36b537c3f3998591f23ba66cccb472a6e3d (diff) |
feat(config): add serialization interval configuration (#2923)
* add serialization interval configuration
* fix e2e tests
* fix e2e tests
Diffstat (limited to 'zellij-utils')
12 files changed, 33 insertions, 0 deletions
diff --git a/zellij-utils/src/input/options.rs b/zellij-utils/src/input/options.rs index e922bd2cb..fbe51cffb 100644 --- a/zellij-utils/src/input/options.rs +++ b/zellij-utils/src/input/options.rs @@ -147,6 +147,10 @@ pub struct Options { #[clap(long, value_parser)] #[serde(default)] pub styled_underlines: Option<bool>, + + /// The interval at which to serialize sessions for resurrection (in seconds) + #[clap(long, value_parser)] + pub serialization_interval: Option<u64>, } #[derive(ArgEnum, Deserialize, Serialize, Debug, Clone, Copy, PartialEq)] @@ -218,6 +222,7 @@ impl Options { .scrollback_lines_to_serialize .or(self.scrollback_lines_to_serialize); let styled_underlines = other.styled_underlines.or(self.styled_underlines); + let serialization_interval = other.serialization_interval.or(self.serialization_interval); Options { simplified_ui, @@ -244,6 +249,7 @@ impl Options { serialize_pane_viewport, scrollback_lines_to_serialize, styled_underlines, + serialization_interval, } } @@ -295,6 +301,7 @@ impl Options { .scrollback_lines_to_serialize .or_else(|| self.scrollback_lines_to_serialize.clone()); let styled_underlines = other.styled_underlines.or(self.styled_underlines); + let serialization_interval = other.serialization_interval.or(self.serialization_interval); Options { simplified_ui, @@ -321,6 +328,7 @@ impl Options { serialize_pane_viewport, scrollback_lines_to_serialize, styled_underlines, + serialization_interval, } } @@ -384,6 +392,7 @@ impl From<CliOptions> for Options { serialize_pane_viewport: opts.serialize_pane_viewport, scrollback_lines_to_serialize: opts.scrollback_lines_to_serialize, styled_underlines: opts.styled_underlines, + serialization_interval: opts.serialization_interval, ..Default::default() } } diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 8fce144d3..8353b6e74 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -1480,6 +1480,9 @@ impl Options { let styled_underlines = kdl_property_first_arg_as_bool_or_error!(kdl_options, "styled_underlines") .map(|(v, _)| v); + let serialization_interval = + kdl_property_first_arg_as_i64_or_error!(kdl_options, "serialization_interval") + .map(|(scroll_buffer_size, _entry)| scroll_buffer_size as u64); Ok(Options { simplified_ui, theme, @@ -1505,6 +1508,7 @@ impl Options { serialize_pane_viewport, scrollback_lines_to_serialize, styled_underlines, + serialization_interval, }) } } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_config_options.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_config_options.snap index b17886775..a4e972b3e 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_config_options.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_config_options.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 686 expression: "format!(\"{:#?}\", options)" --- Options { @@ -29,4 +30,5 @@ Options { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_layout_options.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_layout_options.snap index f6f89eaa6..2e408bf7c 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_layout_options.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__cli_arguments_override_layout_options.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 714 expression: "format!(\"{:#?}\", options)" --- Options { @@ -29,4 +30,5 @@ Options { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments-3.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments-3.snap index 10f7318a1..2bac95f31 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments-3.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments-3.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 673 expression: "format!(\"{:#?}\", options)" --- Options { @@ -27,4 +28,5 @@ Options { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap index cfd5652b0..7d5072a29 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 671 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3592,6 +3593,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: {}, plugins: { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap index 365731714..9c5e198e0 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 729 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3592,6 +3593,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: {}, plugins: { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap index 7a5e39915..a6df2f5ee 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 785 expression: "format!(\"{:#?}\", config)" --- Config { @@ -85,6 +86,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: {}, plugins: { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_options_override_config_options.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_options_override_config_options.snap index 71364b8aa..9d679348e 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_options_override_config_options.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_options_override_config_options.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 696 expression: "format!(\"{:#?}\", options)" --- Options { @@ -29,4 +30,5 @@ Options { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap index c011cb0ed..31a921744 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 757 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3592,6 +3593,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: {}, plugins: { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap index 18ce11438..a6382c05e 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 771 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3592,6 +3593,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: { "other-theme-from-config": Theme { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap index 4d1355669..9dc3f74e1 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap @@ -1,5 +1,6 @@ --- source: zellij-utils/src/setup.rs +assertion_line: 743 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3592,6 +3593,7 @@ Config { serialize_pane_viewport: None, scrollback_lines_to_serialize: None, styled_underlines: None, + serialization_interval: None, }, themes: {}, plugins: { |