diff --git a/src/errors.rs b/src/errors.rs index d1c0d41..0eacd0f 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -39,19 +39,19 @@ impl fmt::Display for SnippetError { } SnippetError::NotFound(ref p) => write!( f, - "The Snippet {:?} doesn't exists. Use -c to create it and/or -E to edit it.",p.file_name().unwrap(), + "The Snippet {} doesn't exists. Use -c to create it and/or -E to edit it.",p.file_name().unwrap().to_str().unwrap(), ), SnippetError::NotFoundNoRetryError(ref p) => { write!( f, - "The Snippet {:?} doen't exists. Use -c to create it.", - p.file_name(), + "The Snippet {} doen't exists. Use -c to create it.", + p.file_name().unwrap().to_str().unwrap(), ) } SnippetError::FoundNoEraseError(ref p) => write!( f, - "The Snippet {:?} already exists. Use -f/--force to overwrite it.", - p.file_name().unwrap(), + "The Snippet {} already exists. Use -f/--force to overwrite it.", + p.file_name().unwrap().to_str().unwrap(), ), SnippetError::ReparsingError => write!(f,"The Snippet couldn't be re-parsed, it might be caused by a bad value in your edit. \nThe snipped was saved as a raw file instead but cant be used as is."), SnippetError::IndexError(ref i) => write!(f,"An error occured while trying to access the index {} of the given arguments.\nThe default arguments for this command likely do not support {} arguments.",i,i+1), diff --git a/src/wrapper_functions.rs b/src/wrapper_functions.rs index 6d76c2d..90bea6c 100644 --- a/src/wrapper_functions.rs +++ b/src/wrapper_functions.rs @@ -160,7 +160,7 @@ pub fn edit_whole_snippet(cli: &Cli) -> Result<(), SnippetError> { } else { // No erasing/overriting println!( - "The snippet could not be saved as {:}.yaml, as this Snippet already exists. The Snippet will be saved under it's original name name: {}", + "The snippet could not be saved as {}.yaml, as this Snippet already exists. The Snippet will be saved under it's original name name: {}", snp.name,origin_p.file_name().unwrap().to_str().unwrap() ); (File::create(&origin_p)?, origin_p) @@ -193,7 +193,7 @@ pub fn list_snippets(_cli: &Cli) -> Result<(), SnippetError> { let dirpath = config_folder()?; let paths = fs::read_dir(&dirpath).unwrap(); println!( - "Snippet list at {:?}:\n {:?}", + "Snippet list at {}:\n {}", dirpath.parent().unwrap().to_str().unwrap(), paths .map(|p| p @@ -205,6 +205,7 @@ pub fn list_snippets(_cli: &Cli) -> Result<(), SnippetError> { .unwrap() .to_owned()) .collect::>() + .join(", ") ); Ok(()) }