use async_trait::async_trait;
use clap::{ArgMatches, Command};
use serde::Serialize;
use serde_json::Value;
use casper_client::cli::CliError;
pub enum Success {
Response(Value),
Output(String),
}
impl<T: Serialize> From<T> for Success {
fn from(response: T) -> Self {
Success::Response(serde_json::to_value(response).expect("should JSON-encode response"))
}
}
#[async_trait]
pub trait ClientCommand {
const NAME: &'static str;
const ABOUT: &'static str;
fn build(display_order: usize) -> Command;
async fn run(matches: &ArgMatches) -> Result<Success, CliError>;
}