From 695e31c7e40202b13f0da202f5b80b9cbf454b98 Mon Sep 17 00:00:00 2001 From: Andrei Stoica Date: Thu, 22 Feb 2024 01:34:11 -0500 Subject: [PATCH] fixed merge conflict --- Cargo.toml | 1 + src/main.rs | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b700b69..e3b3834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] chrono = "0.4.26" +clap = { version = "4.5.1", features = ["derive"] } comrak = "0.18.0" figment = { version = "0.10.10", features = ["env", "serde_json", "json"] } regex = "1.8.4" diff --git a/src/main.rs b/src/main.rs index 5067bae..11a57cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,10 @@ +mod cli; mod config; mod todo; +use crate::cli::Args; +use clap::Parser; + use crate::config::Config; use crate::todo::File as TodoFile; use crate::todo::{Status as TaskStatus, TaskGroup}; @@ -11,19 +15,29 @@ use comrak::{parse_document, Arena}; use comrak::{ComrakExtensionOptions, ComrakOptions, ComrakParseOptions}; use std::borrow::Borrow; use std::collections::HashMap; +<<<<<<< Updated upstream use std::env; use std::fs::{create_dir_all, metadata, read, read_dir, File}; +======= +use std::fs::{read, read_dir, File}; +>>>>>>> Stashed changes use std::io::Write; use std::path::{Path, PathBuf}; use std::process::Command; -use std::str; +use std::{env, str}; //TODO handle unwraps and errors more uniformly //TODO refactor creating new file //TODO clean up verbose printing //TODO create custom errors for better error handling +//TODO Default path for note_dir should start with curent path not home -fn main() { +#[derive(Debug)] +enum ExitError { + ConfigError(String), +} + +fn main() -> Result<(), ExitError> { let expected_cfg_files = Config::expected_locations().unwrap(); println!("{:#?}", expected_cfg_files); let cfg_files: Vec<&Path> = expected_cfg_files @@ -126,6 +140,8 @@ fn main() { .args([current_file]) .status() .expect(format!("failed to launch editor {}", "vim").as_str()); + + Ok(()) } fn get_filepath(data_dir: &PathBuf, date: &NaiveDate) -> PathBuf {