extern crate xml; #[allow(unused)] // use dotenv::dotenv; use env_logger::{ Env, Target }; #[allow(unused)] use log::{debug, info, log_enabled, warn, error}; use reqwest; #[allow(unused)] use std::io::{self, Write}; #[allow(unused)] use xml::reader::{EventReader, XmlEvent}; #[allow(unused)] fn publicise() { } #[allow(unused)] async fn traverse(password: &str) -> Result> { let root_url = "https://theadamcooper.com"; let url_tail = "/nextcloud/remote.php/dav/files/adam/public"; let method = reqwest::Method::from_bytes(b"PROPFIND").unwrap(); let client = reqwest::Client::new(); let response = client.request(method, root_url) .basic_auth("adam", Some(password)) .send() .await?; debug!("{:?}", response); Ok(response) } fn get_password() -> Result { print!("Nextcloud password: "); io::stdout().flush().unwrap(); let mut buffer = String::new(); let stdin = io::stdin(); match stdin.read_line(&mut buffer) { Ok(_) => Ok(buffer), Err(error) => Err(error), } } fn main() { env_logger::Builder::from_env(Env::default().default_filter_or("trace")).target(Target::Stdout).init(); println!("Publicise it!"); let password = get_password().unwrap(); debug!("Received password: {}", password); }