use std::{ ffi::OsString, time::Duration, }; use anyhow::{ anyhow, bail, }; pub async fn main (args: &[OsString]) -> anyhow::Result <()> { let mut url = None; let mut sha512 = None; let mut args = args [1..].into_iter (); loop { let arg = match args.next () { None => break, Some (x) => x, }; match arg.to_str ().ok_or_else (|| anyhow! ("All arguments must be valid UTF-8"))? { "--help" => println! ("For now, just look at the source code"), "--sha512" => { sha512 = args.next (); } arg => { url = Some (arg); break; }, } } let url = match url { None => bail! ("URL argument is required"), Some (x) => x, }; // Cookie 01FYZ3W64SM6KYNP48J6EWSCEF // Try to keep the Clients similar here let client = reqwest::Client::builder () .connect_timeout (Duration::from_secs (30)) .build ()?; Ok (()) }