ncadmin/src/main.rs

38 lines
758 B
Rust
Raw Normal View History

mod api;
2023-09-10 22:54:26 +00:00
mod state;
mod ui;
2023-09-10 22:54:26 +00:00
use anyhow::Result;
use clap::Parser;
/// A tui for administrating nerdcult.net
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// The base URL of the API
#[arg(short, long, default_value = "https://api.nerdcult.net")]
base_url: Option<String>,
/// An access token for the API
#[arg(short, long)]
token: Option<String>,
}
2023-09-10 22:54:26 +00:00
#[tokio::main]
async fn main() -> Result<()> {
let args = Args::parse();
2023-09-10 22:54:26 +00:00
let stdout = ui::prepare()?;
let base_url = args.base_url.unwrap();
2023-09-10 22:54:26 +00:00
let api = {
let mut login = ui::login::UI::new(stdout, base_url)?;
let api = login.run().await?;
api
};
println!("{:#?}", api);
2023-09-10 22:54:26 +00:00
Ok(())
}