diff --git a/src/cli/mod.rs b/src/cli/mod.rs index be6b7dd..c902f9d 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -10,4 +10,8 @@ pub struct Args { /// show current config file #[arg(short = 'C', long)] pub current_config: bool, + + /// veiw previous day's notes + #[arg(short = 'p', long, default_value_t = 0)] + pub previous: u16, } diff --git a/src/main.rs b/src/main.rs index 11f8c7f..1ea31b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,10 +15,9 @@ use std::fs; use std::path::Path; use std::process::Command; -//TODO refactor creating new file - fn main() { let args = Args::parse(); + println!("previous = {}", args.previous); let expected_cfg_files = match Config::expected_locations() { Ok(cfg_files) => cfg_files, @@ -113,8 +112,8 @@ fn main() { Ok(todo_file) => todo_file.file.path(), }; - Command::new(cfg.editor) + Command::new(&cfg.editor) .args([current_file]) .status() - .expect(format!("failed to launch editor {}", "vim").as_str()); + .expect(format!("failed to launch editor {}", &cfg.editor).as_str()); }