11use std:: path:: PathBuf ;
22
3- use color_eyre:: eyre:: { anyhow , Context , Result } ;
3+ use color_eyre:: eyre:: Result ;
44use directories:: ProjectDirs ;
55use lazy_static:: lazy_static;
66use tracing:: error;
@@ -26,21 +26,6 @@ fn project_directory() -> Option<ProjectDirs> {
2626 ProjectDirs :: from ( "com" , "kdheepak" , PROJECT_NAME . clone ( ) . to_lowercase ( ) . as_str ( ) )
2727}
2828
29- pub fn is_markdown_file ( path : PathBuf ) -> Result < ( ) > {
30- if !path. exists ( ) {
31- return Err ( anyhow ! ( "{:?} does not exist" , path) ) ;
32- }
33- if !path. is_file ( ) {
34- return Err ( anyhow ! ( "{:?} is not a file" , path) ) ;
35- }
36-
37- // Check file extension
38- match path. extension ( ) {
39- Some ( ext) if ext == "md" || ext == "qmd" || ext == "rmd" || ext == "markdown" => Ok ( ( ) ) ,
40- _ => Err ( anyhow ! ( "{:?} must have a .md or .markdown extension" , path) ) ,
41- }
42- }
43-
4429pub fn initialize_panic_handler ( ) -> Result < ( ) > {
4530 let ( panic_hook, eyre_hook) = color_eyre:: config:: HookBuilder :: default ( ) . into_hooks ( ) ;
4631 eyre_hook. install ( ) ?;
@@ -104,7 +89,7 @@ pub fn get_config_dir() -> PathBuf {
10489
10590pub fn initialize_logging ( ) -> Result < ( ) > {
10691 let directory = get_data_dir ( ) ;
107- std:: fs:: create_dir_all ( directory. clone ( ) ) . context ( format ! ( "{directory:?} could not be created" ) ) ?;
92+ std:: fs:: create_dir_all ( directory. clone ( ) ) ?;
10893 let log_path = directory. join ( LOG_FILE . clone ( ) ) ;
10994 let log_file = std:: fs:: File :: create ( log_path) ?;
11095 let file_subscriber = tracing_subscriber:: fmt:: layer ( )
0 commit comments