mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Run cargo fmt
This commit is contained in:
parent
0396dfc096
commit
05abc5bdad
10
src/ilias.rs
10
src/ilias.rs
@ -10,7 +10,7 @@ use reqwest_cookie_store::CookieStoreMutex;
|
||||
use scraper::{ElementRef, Html, Selector};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::{cli::Opt, queue, util::wrap_html, ILIAS_URL, iliasignore::IliasIgnore};
|
||||
use crate::{cli::Opt, iliasignore::IliasIgnore, queue, util::wrap_html, ILIAS_URL};
|
||||
|
||||
pub mod course;
|
||||
pub mod exercise;
|
||||
@ -285,7 +285,13 @@ impl ILIAS {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok((ILIAS::get_items(&html), main_text, html.select(&LINKS).flat_map(|x| x.value().attr("href").map(|x| x.to_owned())).collect()))
|
||||
Ok((
|
||||
ILIAS::get_items(&html),
|
||||
main_text,
|
||||
html.select(&LINKS)
|
||||
.flat_map(|x| x.value().attr("href").map(|x| x.to_owned()))
|
||||
.collect(),
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn get_course_content_tree(&self, ref_id: &str, cmd_node: &str) -> Result<Vec<Object>> {
|
||||
|
@ -1,11 +1,14 @@
|
||||
use std::{path::{Path, PathBuf, Component}, ffi::OsString};
|
||||
use std::{
|
||||
ffi::OsString,
|
||||
path::{Component, Path, PathBuf},
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use ignore::gitignore::Gitignore;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct IliasIgnore {
|
||||
ignores: Vec<IgnoreFile>
|
||||
ignores: Vec<IgnoreFile>,
|
||||
}
|
||||
|
||||
impl IliasIgnore {
|
||||
@ -28,20 +31,18 @@ impl IliasIgnore {
|
||||
acc.push(el);
|
||||
acc.push("/");
|
||||
acc
|
||||
})
|
||||
}),
|
||||
});
|
||||
}
|
||||
if let Some(last) = path.components().last() {
|
||||
match last {
|
||||
Component::Normal(name) => prefix.insert(0, name.to_owned()),
|
||||
_ => break
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
path.pop();
|
||||
}
|
||||
Ok(IliasIgnore {
|
||||
ignores
|
||||
})
|
||||
Ok(IliasIgnore { ignores })
|
||||
}
|
||||
|
||||
pub fn should_ignore(&self, path: &Path, is_dir: bool) -> bool {
|
||||
@ -62,5 +63,5 @@ impl IliasIgnore {
|
||||
#[derive(Clone, Debug)]
|
||||
struct IgnoreFile {
|
||||
ignore: Gitignore,
|
||||
prefix: OsString
|
||||
prefix: OsString,
|
||||
}
|
Loading…
Reference in New Issue
Block a user