| 113 | } |
| 114 | |
| 115 | fn parse_delegation_command(matches: &ArgMatches) -> Result<CliCommand, CliError> { |
| 116 | match matches.subcommand() { |
| 117 | Some(("create", matches)) => Ok(CliCommand::DelegationCreate { |
| 118 | worker_id: parse_u64("worker_id", matches)?, |
| 119 | }), |
| 120 | Some(("deposit", matches)) => Ok(CliCommand::DelegationDeposit { |
| 121 | amount: parse_u64("amount", matches)?, |
| 122 | delegation_id: parse_u64("delegation_id", matches)?, |
| 123 | worker_id: parse_u64("worker_id", matches)?, |
| 124 | }), |
| 125 | Some(("get", matches)) => Ok(CliCommand::DelegationGet { |
| 126 | delegation_id: parse_u64("delegation_id", matches)?, |
| 127 | worker_id: parse_u64("worker_id", matches)?, |
| 128 | }), |
| 129 | Some(("withdraw", matches)) => Ok(CliCommand::DelegationWithdraw { |
| 130 | amount: parse_u64("amount", matches)?, |
| 131 | delegation_id: parse_u64("delegation_id", matches)?, |
| 132 | worker_id: parse_u64("worker_id", matches)?, |
| 133 | }), |
| 134 | _ => Err(CliError::CommandNotRecognized( |
| 135 | matches.subcommand().unwrap().0.into(), |
| 136 | )), |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | fn parse_explorer_command(matches: &ArgMatches) -> Result<CliCommand, CliError> { |
| 141 | match matches.subcommand() { |