Implement logging and user input
This commit is contained in:
parent
f6de295e4c
commit
f020ecb6d9
4 changed files with 1156 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/target
|
||||
.env
|
||||
Cargo.lock
|
||||
|
|
1111
Cargo.lock
generated
Normal file
1111
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -6,3 +6,9 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dotenv = "0.15.0"
|
||||
env_logger = "0.8.4"
|
||||
log = "0.4.0"
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
xml-rs = "0.8.4"
|
||||
|
|
39
src/main.rs
39
src/main.rs
|
@ -1,3 +1,38 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
extern crate xml;
|
||||
|
||||
// use dotenv::dotenv;
|
||||
use env_logger::{ Env, Target };
|
||||
use log::{debug, info, log_enabled, warn, error};
|
||||
use reqwest;
|
||||
use std::io::{self, Write};
|
||||
use xml::reader::{EventReader, XmlEvent};
|
||||
|
||||
|
||||
fn publicise() {
|
||||
}
|
||||
|
||||
async fn traverse(password: &str) -> Result<reqwest::Response, Box<dyn std::error::Error>> {
|
||||
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?;
|
||||
// env_logger::Debug(response);
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
env_logger::Builder::from_env(Env::default().default_filter_or("trace")).target(Target::Stdout).init();
|
||||
println!("Publicise it!");
|
||||
print!("Nextcloud password: ");
|
||||
io::stdout().flush().unwrap();
|
||||
let mut buffer = String::new();
|
||||
let stdin = io::stdin();
|
||||
match stdin.read_line(&mut buffer) {
|
||||
Ok(_) => debug!("buffer: {}", buffer),
|
||||
Err(error) => println!("error: {}", error),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue