use super::operators; use crate::{cli_print, config}; use clap::ArgMatches; pub fn handle_operators(matches: &ArgMatches) { match matches.subcommand() { Some(("list", _)) => { cli_print(operators::print_operators().map_err(Into::into)); } Some(("register", subcom_args)) => { let escrow: u64 = *subcom_args.get_one::("escrow").unwrap(); let email: String = subcom_args.get_one::("email").unwrap().clone(); cli_print(operators::register(escrow, email).map_err(Into::into)); } Some(("inspect", inspect_args)) => { let wallet = match inspect_args.get_one::("wallet") { Some(wallet) => wallet.to_string(), None => config::Config::get_detee_wallet().unwrap_or("".to_string()), }; cli_print(operators::inspect_operator(wallet).map_err(Into::into)); } Some(("kick", subcom_args)) => { let uuid: String = subcom_args.get_one::("contract").unwrap().clone(); let reason: String = subcom_args.get_one::("reason").unwrap().clone(); cli_print(operators::kick(uuid, reason).map_err(Into::into)); } Some(("ban-user", subcom_args)) => { let user_wallet: String = subcom_args.get_one::("wallet").unwrap().clone(); cli_print(operators::ban(user_wallet).map_err(Into::into)); } Some(("decom", _)) => { todo!("Currently decomissioning is not supported. Will be "); } _ => println!("To get more information about operators, use: detee-cli operator --help"), } }