a CLI tool to post updates to crunk-scheduler.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#![deny(warnings)]
|
|
|
|
|
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
/// Search for a pattern in a file and display the lines that contain it.
|
|
|
|
#[derive(Parser)]
|
|
|
|
|
|
|
|
struct Cli {
|
|
|
|
url: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is using the `tokio` runtime. You'll need the following dependency:
|
|
|
|
//
|
|
|
|
// `tokio = { version = "1", features = ["full"] }`
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), reqwest::Error> {
|
|
|
|
// Some simple CLI args requirements...
|
|
|
|
let args = Cli::parse();
|
|
|
|
let url = args.url;
|
|
|
|
|
|
|
|
eprintln!("Fetching {:?}...", url);
|
|
|
|
let res = reqwest::get(url).await?;
|
|
|
|
|
|
|
|
eprintln!("Response: {:?} {}", res.version(), res.status());
|
|
|
|
eprintln!("Headers: {:#?}\n", res.headers());
|
|
|
|
let body = res.text().await?;
|
|
|
|
println!("{}", body);
|
|
|
|
Ok(())
|
|
|
|
}
|