affluence/affluences-cli/src/main.rs

31 lines
703 B
Rust

use affluences_api::AffluencesClient;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
#[command(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
enum Commands {
/// does testing things
SearchSite { query: String },
}
#[tokio::main]
async fn main() {
let cli = Cli::parse();
let client = AffluencesClient::new();
match &cli.command {
Some(Commands::SearchSite { query }) => {
let res = client.search(query.to_string()).await.unwrap();
let s = serde_json::to_string_pretty(&res).unwrap();
println!("{}", s);
}
None => {}
}
}