aboutsummaryrefslogtreecommitdiff
path: root/src/config/model.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-02 21:48:02 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-02 21:48:02 +0300
commitb751d102f158968aab681cb663d27b4c32197f62 (patch)
tree85d03609314559df7705c2cb0ab4e37ab6d9715f /src/config/model.rs
parent295b09ca25edbccac65401ee84fa420dd3888aad (diff)
feat: add preview update channel
Diffstat (limited to 'src/config/model.rs')
-rw-r--r--src/config/model.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/config/model.rs b/src/config/model.rs
index f815fb8d..7895341f 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -10,6 +10,37 @@ use super::{
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
+pub enum UpdateChannelConfig {
+ #[default]
+ Stable,
+ Preview,
+}
+
+impl UpdateChannelConfig {
+ pub fn as_str(self) -> &'static str {
+ match self {
+ Self::Stable => "stable",
+ Self::Preview => "preview",
+ }
+ }
+}
+
+#[derive(Debug, Clone, Copy, Deserialize)]
+#[serde(default)]
+pub struct UpdateConfig {
+ pub channel: UpdateChannelConfig,
+}
+
+impl Default for UpdateConfig {
+ fn default() -> Self {
+ Self {
+ channel: UpdateChannelConfig::Stable,
+ }
+ }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
+#[serde(rename_all = "lowercase")]
pub enum ToastDelivery {
#[default]
Off,
@@ -187,6 +218,7 @@ pub struct Config {
pub theme: ThemeConfig,
pub terminal: TerminalConfig,
pub session: SessionConfig,
+ pub update: UpdateConfig,
pub keys: KeysConfig,
pub ui: UiConfig,
pub worktrees: WorktreesConfig,
@@ -589,6 +621,20 @@ mod tests {
use super::*;
#[test]
+ fn update_channel_defaults_stable_and_parses() {
+ let default_config = Config::default();
+ assert_eq!(default_config.update.channel, UpdateChannelConfig::Stable);
+
+ let toml = r#"
+[update]
+channel = "preview"
+"#;
+ let config: Config = toml::from_str(toml).unwrap();
+ assert_eq!(config.update.channel, UpdateChannelConfig::Preview);
+ assert_eq!(config.update.channel.as_str(), "preview");
+ }
+
+ #[test]
fn terminal_default_shell_defaults_empty_and_parses() {
let default_config = Config::default();
assert!(default_config.terminal.default_shell.is_empty());