Skip to content

Commit

Permalink
Add command-line option to download all courses
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst committed Mar 21, 2022
1 parent d063abc commit 8906069
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 8906069

Please sign in to comment.