objectiveai-cli 2.1.1

ObjectiveAI command-line interface and embeddable library
//! `config viewer address get` — read `viewer.address` from on-disk
//! config.

use objectiveai_sdk::cli::command::config::viewer::address::get::{Request, Response};

use crate::context::Context;
use crate::error::Error;

pub async fn execute(ctx: &Context, _request: Request) -> Result<Response, Error> {
    let mut config = ctx.filesystem.read_config().await?;
    Ok(Response {
        address: config.viewer().get_address().map(String::from),
    })
}

pub mod request_schema {
    use objectiveai_sdk::cli::command::config::viewer::address::get as sdk;
    use objectiveai_sdk::cli::command::config::viewer::address::get::request_schema::{Request, Response};

    use crate::context::Context;
    use crate::error::Error;

    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Request)))
    }
}

pub mod response_schema {
    use objectiveai_sdk::cli::command::config::viewer::address::get as sdk;
    use objectiveai_sdk::cli::command::config::viewer::address::get::response_schema::{Request, Response};

    use crate::context::Context;
    use crate::error::Error;

    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Response)))
    }
}