feat(tui): add vim-like keybinds and settings tab for config edit
Some checks failed
build / checks-build (push) Has been cancelled
build / codecov (push) Has been cancelled
docs / docs (push) Has been cancelled
build / checks-matrix (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-10-08 16:11:41 +05:30
parent 48e26332a3
commit a8f0ab160e
6 changed files with 660 additions and 55 deletions

View File

@@ -5,6 +5,7 @@ use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AppConfig {
pub sonarr: SonarrConfig,
pub ui: UiConfig,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -13,6 +14,33 @@ pub struct SonarrConfig {
pub api_key: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UiConfig {
pub keybind_mode: KeybindMode,
pub show_help: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum KeybindMode {
Normal,
Vim,
}
impl Default for KeybindMode {
fn default() -> Self {
Self::Normal
}
}
impl Default for UiConfig {
fn default() -> Self {
Self {
keybind_mode: KeybindMode::default(),
show_help: true,
}
}
}
impl Default for AppConfig {
fn default() -> Self {
Self {
@@ -20,6 +48,7 @@ impl Default for AppConfig {
url: "http://localhost:8989".to_string(),
api_key: String::new(),
},
ui: UiConfig::default(),
}
}
}
@@ -92,6 +121,10 @@ impl AppConfig {
url: "http://localhost:8989".to_string(),
api_key: "your-api-key-here".to_string(),
},
ui: UiConfig {
keybind_mode: KeybindMode::Normal,
show_help: true,
},
};
let toml_content = toml::to_string_pretty(&sample_config)?;