Skip to main content

agent_first_http/cli/cmd/
capabilities.rs

1//! `afhttp capabilities` subcommand.
2
3use clap::Args as ClapArgs;
4
5use crate::cli::output;
6use crate::sdk::Client;
7use crate::shared::error::Error;
8
9#[derive(ClapArgs, Debug)]
10pub struct Args {
11    /// CDP endpoint of the running host.
12    #[arg(long = "endpoint-url")]
13    pub endpoint: String,
14    /// Bearer token, if the host was started with `--token-secret`.
15    #[arg(long = "token-secret")]
16    pub token: Option<String>,
17}
18
19pub async fn run(args: Args) -> Result<(), Error> {
20    let mut client = Client::connect(&args.endpoint)?;
21    if let Some(t) = args.token.as_deref() {
22        client = client.with_token(t);
23    }
24    let response = client.capabilities().await?;
25    output::emit("capabilities", &response)
26}