Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Commit 4ca28f3

Browse files
committed
fix: Remove is_markdown_file function 🐛
1 parent bbed63f commit 4ca28f3

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

src/utils.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::PathBuf;
22

3-
use color_eyre::eyre::{anyhow, Context, Result};
3+
use color_eyre::eyre::Result;
44
use directories::ProjectDirs;
55
use lazy_static::lazy_static;
66
use 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-
4429
pub 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

10590
pub 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

Comments
 (0)