diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-05-14 23:28:30 +0200 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-24 23:06:50 +0200 |
| commit | 80fe803ffd49c0aa05c3883d04c0239e5dd5bae1 (patch) | |
| tree | bec4de7a2e53060f78744bd7a0341c2a9d7deb8c /zellij-tile | |
| parent | feat(build): incorporate git committing and tagging into the publish process (diff) | |
| download | sl0ppij-80fe803ffd49c0aa05c3883d04c0239e5dd5bae1.tar.gz sl0ppij-80fe803ffd49c0aa05c3883d04c0239e5dd5bae1.tar.xz sl0ppij-80fe803ffd49c0aa05c3883d04c0239e5dd5bae1.zip | |
Default mode 368
* Parsing Implemented
* Adds option to specify a default mode
either through a flag `--options default-mode [MODE]`,
or a configuration option `default_mode: [MODE]`
closes #368
Diffstat (limited to 'zellij-tile')
| -rw-r--r-- | zellij-tile/src/data.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index c1b9c30e..cf9c8265 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use std::str::FromStr; use strum_macros::{EnumDiscriminants, EnumIter, EnumString, ToString}; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -89,6 +90,23 @@ impl Default for PaletteColor { } } +impl FromStr for InputMode { + type Err = Box<dyn std::error::Error>; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + match s { + "normal" => Ok(InputMode::Normal), + "resize" => Ok(InputMode::Resize), + "locked" => Ok(InputMode::Locked), + "pane" => Ok(InputMode::Pane), + "tab" => Ok(InputMode::Tab), + "scroll" => Ok(InputMode::Scroll), + "renametab" => Ok(InputMode::RenameTab), + e => Err(e.to_string().into()), + } + } +} + #[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] pub enum PaletteSource { Default, |
