Wire in the ListReleases primary command
Hey, look at that. I can do the thing what with the stuff and such.
This commit is contained in:
45
src/main.rs
45
src/main.rs
@@ -1,36 +1,33 @@
|
||||
use gt_tools::{
|
||||
ReleaseInfo,
|
||||
cli::Args
|
||||
};
|
||||
use gt_tools::{ReleaseInfo, cli::Args};
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
use reqwest::Error;
|
||||
use reqwest::header::{
|
||||
USER_AGENT,
|
||||
ACCEPT
|
||||
};
|
||||
use reqwest::header::{ACCEPT, USER_AGENT};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Error> {
|
||||
let args = Args::parse();
|
||||
|
||||
println!("{:?}", args);
|
||||
|
||||
let request_url = format!(
|
||||
"http:/localhost:3000/api/v1/repos/{owner}/{repo}/releases",
|
||||
owner = "robert",
|
||||
repo = "rcalc",
|
||||
);
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.get(request_url)
|
||||
.header(USER_AGENT, "gt-tools-test-agent")
|
||||
.header(ACCEPT, "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
let body_text: Vec<ReleaseInfo> = response.json().await?;
|
||||
match args.command {
|
||||
gt_tools::cli::Commands::ListReleases { list } => {
|
||||
let request_url = format!(
|
||||
"http:/localhost:3000/api/v1/repos/{owner}/{repo}/releases",
|
||||
owner = "robert",
|
||||
repo = "rcalc",
|
||||
);
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.get(request_url)
|
||||
.header(USER_AGENT, "gt-tools-test-agent")
|
||||
.header(ACCEPT, "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
let body_text: Vec<ReleaseInfo> = response.json().await?;
|
||||
|
||||
println!("{:?}", body_text);
|
||||
}
|
||||
}
|
||||
|
||||
println!("{:?}", body_text);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user