oauth-db-cli 0.1.0

Command-line tool for managing OAuth-DB platform
Documentation
use crate::auth;
use crate::error::Result;
use crate::output::{create_table, print_table};
use comfy_table::Cell;

pub async fn execute() -> Result<()> {
    // Get current account
    let account = auth::get_current_account()?;

    // Get API client and fetch user info
    let client = auth::get_api_client()?;
    let user_info = client.get_me().await?;

    // Create table
    let mut table = create_table();
    table.set_header(vec!["Field", "Value"]);

    table.add_row(vec![
        Cell::new("Account Name"),
        Cell::new(&account.name),
    ]);
    table.add_row(vec![
        Cell::new("Server"),
        Cell::new(&account.server),
    ]);
    table.add_row(vec![
        Cell::new("Username"),
        Cell::new(&user_info.username),
    ]);
    table.add_row(vec![
        Cell::new("Email"),
        Cell::new(&user_info.email),
    ]);
    table.add_row(vec![
        Cell::new("User ID"),
        Cell::new(&user_info.id),
    ]);
    table.add_row(vec![
        Cell::new("Role"),
        Cell::new(&user_info.role),
    ]);
    table.add_row(vec![
        Cell::new("Status"),
        Cell::new(&user_info.status),
    ]);
    table.add_row(vec![
        Cell::new("Created At"),
        Cell::new(&user_info.created_at),
    ]);

    print_table(table);

    Ok(())
}