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.

36 lines
862 B

#![deny(warnings)]
use clap::Parser;
/// Search for a pattern in a file and display the lines that contain it.
#[derive(Parser)]
#[command(name = "crunk-update")]
#[command(author = "Crunk")]
#[command(version = "1.0")]
#[command(about = "post updates to crunk-schedulers", long_about = None)]
struct Cli {
#[arg(long)]
url: String,
#[arg(long)]
text: String,
}
#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let args = Cli::parse();
let url = args.url;
let text = args.text;
let client = reqwest::Client::new();
let res = client.post(url).form(&[("text", text)]).send().await?;
eprintln!("Response: {:?} {}", res.version(), res.status());
eprintln!("Headers: {:#?}\n", res.headers());
let body = res.text().await?;
println!("{}", body);
Ok(())
}