feat(tui): add vim-like keybinds and settings tab for config edit
This commit is contained in:
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user