From 8906069a67b2f0aa9702018acf365c6b6b9841ed Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Mon, 21 Mar 2022 11:44:06 +0100 Subject: [PATCH] Add command-line option to download all courses --- src/cli.rs | 4 ++++ src/main.rs | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index ed6e282..6f1f38d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -83,6 +83,10 @@ pub struct Opt { /// Attempt to re-use session cookies #[structopt(long)] pub keep_session: bool, + + /// Download all courses + #[structopt(long)] + pub all: bool, } pub static LOG_LEVEL: AtomicUsize = AtomicUsize::new(0); diff --git a/src/main.rs b/src/main.rs index 3ebc493..c01f1a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,9 +160,14 @@ async fn real_main(mut opt: Opt) -> Result<()> { PROGRESS_BAR.set_message("initializing.."); } - let sync_url = ilias.opt.sync_url.as_deref().unwrap_or(DEFAULT_SYNC_URL); + let sync_url = if ilias.opt.all { + // change on ILIAS update + format!("{}ilias.php?cmdClass=ilmembershipoverviewgui&cmdNode=iy&baseClass=ilmembershipoverviewgui", ILIAS_URL) + } else { + ilias.opt.sync_url.as_deref().unwrap_or(DEFAULT_SYNC_URL).to_owned() + }; let obj = Object::from_url( - URL::from_href(sync_url).context("invalid sync URL")?, + URL::from_href(&sync_url).context("invalid sync URL")?, String::new(), None, )