use clap::{Parser, Subcommand};
use crate::{calls, zome_call};
#[derive(Debug, Subcommand)]
pub enum ClientCommand {
Call(calls::Call),
#[command(name = "zome-call-auth")]
ZomeCallAuth(zome_call::ZomeCallAuth),
#[command(name = "zome-call")]
ZomeCall(zome_call::ZomeCall),
}
#[derive(Debug, Parser)]
#[command(
name = "client",
about = "Connect to and interact with running Holochain conductors",
author,
version
)]
pub struct HcClient {
#[command(subcommand)]
pub command: ClientCommand,
}
impl HcClient {
pub async fn run(self) -> anyhow::Result<()> {
match self.command {
ClientCommand::Call(call) => calls::call(call).await,
ClientCommand::ZomeCallAuth(auth) => zome_call::zome_call_auth(auth).await,
ClientCommand::ZomeCall(call) => zome_call::zome_call(call).await,
}
}
}