diff --git a/src/cli.rs b/src/cli.rs index 42795c7..4510c12 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -6,6 +6,9 @@ pub struct Cli { #[arg(short = 'C', long, global = true, help = "Path to config file")] pub config: Option, + #[arg(short = 'D', long, global = true, help = "Path to state directory (default: /tmp/rss or $RSS_STATE_DIR)")] + pub state_dir: Option, + #[command(subcommand)] pub command: Commands, } diff --git a/src/main.rs b/src/main.rs index cc56a34..3a7951b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,10 @@ use std::sync::atomic::{AtomicBool, Ordering}; fn main() { let cli = Cli::parse(); + if let Some(ref dir) = cli.state_dir { + std::env::set_var("RSS_STATE_DIR", dir); + } + match cli.command { Commands::Daemon => { let config_path = resolve_config_path(cli.config.as_deref());