diff --git a/client_cli/src/main.rs b/client_cli/src/main.rs index 20abd7859ec..edec5ec0384 100644 --- a/client_cli/src/main.rs +++ b/client_cli/src/main.rs @@ -363,11 +363,13 @@ mod domain { /// List domains #[clap(subcommand)] List(List), + /// Transfer domain + Transfer(Transfer), } impl RunArgs for Args { fn run(self, context: &mut dyn RunContext) -> Result<()> { - match_all!((self, context), { Args::Register, Args::List }) + match_all!((self, context), { Args::Register, Args::List, Args::Transfer }) } } @@ -420,6 +422,36 @@ mod domain { Ok(()) } } + + /// Transfer a domain between accounts + #[derive(Debug, StructOpt)] + pub struct Transfer { + /// Domain name as double-quited string + #[structopt(short, long)] + pub id: DomainId, + /// Account from which to transfer (in form `name@domain_name') + #[structopt(short, long)] + pub from: AccountId, + /// Account from which to transfer (in form `name@domain_name') + #[structopt(short, long)] + pub to: AccountId, + /// The JSON/JSON5 file with key-value metadata pairs + #[structopt(short, long, default_value = "")] + pub metadata: super::Metadata, + } + + impl RunArgs for Transfer { + fn run(self, context: &mut dyn RunContext) -> Result<()> { + let Self { + id, + from, + to, + metadata: Metadata(metadata), + } = self; + let transfer_domain = TransferExpr::new(from, id, to); + submit([transfer_domain], metadata, context).wrap_err("Failed to transfer domain") + } + } } mod account {