diff --git a/src/main.rs b/src/main.rs index c9631a3..49f2290 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,9 +20,9 @@ struct Args { enum Commands { /// Scrapes the lofi girl website file server for files. Scrape { - /// The file extention to search for, defaults to mp3. + /// The file extension to search for, defaults to mp3. #[clap(long, short, default_value = "mp3")] - extention: String, + extension: String, /// Whether to include the full HTTP URL or just the distinguishing part. #[clap(long, short)] @@ -37,9 +37,9 @@ async fn main() -> eyre::Result<()> { if let Some(command) = cli.command { match command { Commands::Scrape { - extention, + extension, include_full, - } => scrape::scrape(extention, include_full).await, + } => scrape::scrape(extension, include_full).await, } } else { play::play().await diff --git a/src/scrape.rs b/src/scrape.rs index deec452..3783c15 100644 --- a/src/scrape.rs +++ b/src/scrape.rs @@ -26,8 +26,8 @@ async fn parse(path: &str) -> eyre::Result> { /// /// It's a bit hacky, and basically works by checking all of the years, then months, and then all of the files. /// This is done as a way to avoid recursion, since async rust really hates recursive functions. -async fn scan(extention: &str, include_full: bool) -> eyre::Result> { - let extention = &format!(".{}", extention); +async fn scan(extension: &str, include_full: bool) -> eyre::Result> { + let extension = &format!(".{}", extension); let items = parse("").await?; @@ -53,7 +53,7 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result> items .into_iter() .filter_map(|x| { - if x.ends_with(extention) { + if x.ends_with(extension) { if include_full { Some(format!("{BASE_URL}{path}{x}")) } else { @@ -76,8 +76,8 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result> eyre::Result::Ok(files) } -pub async fn scrape(extention: String, include_full: bool) -> eyre::Result<()> { - let files = scan(&extention, include_full).await?; +pub async fn scrape(extension: String, include_full: bool) -> eyre::Result<()> { + let files = scan(&extension, include_full).await?; for file in files { println!("{}", file); }