diff --git a/__crypto/simple_contract/src/cmd_credit_create.rs b/__crypto/simple_contract/src/cmd_credit_create.rs index 3668389..3d7edb6 100644 --- a/__crypto/simple_contract/src/cmd_credit_create.rs +++ b/__crypto/simple_contract/src/cmd_credit_create.rs @@ -12,9 +12,15 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Create credit contract subcommand") - .arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name")) - .arg(Arg::with_name("limit").long("limit").short("l").required(true).takes_value(true).help("Contract credit limit")) - .arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair")) + .arg(Arg::with_name("name").long("name").short("n") + .required(true).takes_value(true).help("Contract name") + ) + .arg(Arg::with_name("limit").long("limit").short("l") + .required(true).takes_value(true).help("Contract credit limit") + ) + .arg(Arg::with_name("key").long("key").short("k") + .required(true).takes_value(true).help("Key pair") + ) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/cmd_credit_issue.rs b/__crypto/simple_contract/src/cmd_credit_issue.rs index 57aadc8..d5fdef9 100644 --- a/__crypto/simple_contract/src/cmd_credit_issue.rs +++ b/__crypto/simple_contract/src/cmd_credit_issue.rs @@ -12,10 +12,18 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Issue credit contract subcommand") - .arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name")) - .arg(Arg::with_name("receiver").long("receiver").short("r").required(true).takes_value(true).help("Receiver")) - .arg(Arg::with_name("credit").long("credit").short("c").required(true).takes_value(true).help("Credit")) - .arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair")) + .arg(Arg::with_name("name").long("name").short("n") + .required(true).takes_value(true).help("Contract name") + ) + .arg(Arg::with_name("receiver").long("receiver").short("r") + .required(true).takes_value(true).help("Receiver") + ) + .arg(Arg::with_name("credit").long("credit").short("c") + .required(true).takes_value(true).help("Credit") + ) + .arg(Arg::with_name("key").long("key").short("k") + .required(true).takes_value(true).help("Key pair") + ) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/cmd_credit_query.rs b/__crypto/simple_contract/src/cmd_credit_query.rs index b1aeb73..6c69a75 100644 --- a/__crypto/simple_contract/src/cmd_credit_query.rs +++ b/__crypto/simple_contract/src/cmd_credit_query.rs @@ -12,9 +12,15 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Query credit contract subcommand") - .arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name")) - .arg(Arg::with_name("account").long("account").short("a").required(true).takes_value(true).help("Account")) - .arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair")) + .arg(Arg::with_name("name").long("name").short("n") + .required(true).takes_value(true).help("Contract name") + ) + .arg(Arg::with_name("account").long("account").short("a") + .required(true).takes_value(true).help("Account") + ) + .arg(Arg::with_name("key").long("key").short("k") + .required(true).takes_value(true).help("Key pair") + ) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/cmd_credit_queryall.rs b/__crypto/simple_contract/src/cmd_credit_queryall.rs index f70fcd4..0ae0e78 100644 --- a/__crypto/simple_contract/src/cmd_credit_queryall.rs +++ b/__crypto/simple_contract/src/cmd_credit_queryall.rs @@ -12,8 +12,12 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Queryall credit contract subcommand") - .arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name")) - .arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair")) + .arg(Arg::with_name("name").long("name").short("n") + .required(true).takes_value(true).help("Contract name") + ) + .arg(Arg::with_name("key").long("key").short("k") + .required(true).takes_value(true).help("Key pair") + ) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/cmd_credit_transfer.rs b/__crypto/simple_contract/src/cmd_credit_transfer.rs index 3daf4b4..5194ccc 100644 --- a/__crypto/simple_contract/src/cmd_credit_transfer.rs +++ b/__crypto/simple_contract/src/cmd_credit_transfer.rs @@ -12,10 +12,18 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Transfer credit contract subcommand") - .arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name")) - .arg(Arg::with_name("receiver").long("receiver").short("r").required(true).takes_value(true).help("Receiver")) - .arg(Arg::with_name("credit").long("credit").short("c").required(true).takes_value(true).help("Credit")) - .arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair")) + .arg(Arg::with_name("name").long("name").short("n") + .required(true).takes_value(true).help("Contract name") + ) + .arg(Arg::with_name("receiver").long("receiver").short("r") + .required(true).takes_value(true).help("Receiver") + ) + .arg(Arg::with_name("credit").long("credit").short("c") + .required(true).takes_value(true).help("Credit") + ) + .arg(Arg::with_name("key").long("key").short("k") + .required(true).takes_value(true).help("Key pair") + ) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/cmd_genkey.rs b/__crypto/simple_contract/src/cmd_genkey.rs index aedc7f5..3c947fb 100644 --- a/__crypto/simple_contract/src/cmd_genkey.rs +++ b/__crypto/simple_contract/src/cmd_genkey.rs @@ -10,8 +10,10 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("Generate key pair subcommand") - .arg(Arg::with_name("output").long("output").short("o").required(true).takes_value(true).help("Key pair output")) - .arg(Arg::with_name("tag").long("tag").short("t").takes_value(true).help("Key pair output")) + .arg(Arg::with_name("output").long("output").short("o") + .required(true).takes_value(true).help("Key pair output") + ) + .arg(Arg::with_name("tag").long("tag").short("t").takes_value(true).help("Key pair output")) } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/__crypto/simple_contract/src/credit.rs b/__crypto/simple_contract/src/credit.rs index 70c42ba..91a91be 100644 --- a/__crypto/simple_contract/src/credit.rs +++ b/__crypto/simple_contract/src/credit.rs @@ -32,7 +32,13 @@ impl CreditContract { return simple_error!("Cannot issue 0 credit!"); } if self.issue_amount + credit > self.credit_limit { - return simple_error!("Issue too much credit, current: {}, issue: {}, limit: {}, left: {}", self.issue_amount, credit, self.credit_limit, self.credit_limit - self.issue_amount); + return simple_error!( + "Issue too much credit, current: {}, issue: {}, limit: {}, left: {}", + self.issue_amount, + credit, + self.credit_limit, + self.credit_limit - self.issue_amount + ); } match self.credit.get_mut(receiver) { None => { self.credit.insert(receiver.to_owned(), credit); },