45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
#[macro_use] extern crate rust_util;
|
|
|
|
mod util;
|
|
mod tx;
|
|
mod credit;
|
|
mod credit_util;
|
|
mod engine;
|
|
mod engine_plugin_credit;
|
|
|
|
mod cmd_genkey;
|
|
mod cmd_credit_create;
|
|
mod cmd_credit_issue;
|
|
mod cmd_credit_transfer;
|
|
mod cmd_credit_query;
|
|
mod cmd_credit_queryall;
|
|
|
|
use clap::{App, Arg, ArgMatches};
|
|
use rust_util::{XResult, util_clap::{CommandError, CommandExecutor, DefaultCommand}};
|
|
|
|
pub struct DefaultCommandImpl;
|
|
impl DefaultCommand for DefaultCommandImpl {
|
|
fn process_command<'a>(&self, app: App<'a, 'a>) -> App<'a, 'a> {
|
|
app.arg(Arg::with_name("verbose").long("verbose").short("v").multiple(true).help("Show verbose info"))
|
|
}
|
|
|
|
fn run(&self, arg_matches: &ArgMatches) -> CommandError {
|
|
let verbose_count = arg_matches.occurrences_of("verbose");
|
|
information!("Verbose count: {}", verbose_count);
|
|
information!("Try use help (--help) print usage");
|
|
Ok(None)
|
|
}
|
|
}
|
|
|
|
fn main() -> XResult<()> {
|
|
let mut c = CommandExecutor::new(Some(Box::new(DefaultCommandImpl)));
|
|
c.add(Box::new(cmd_genkey::CommandImpl));
|
|
c.add(Box::new(cmd_credit_create::CommandImpl));
|
|
c.add(Box::new(cmd_credit_issue::CommandImpl));
|
|
c.add(Box::new(cmd_credit_transfer::CommandImpl));
|
|
c.add(Box::new(cmd_credit_query::CommandImpl));
|
|
c.add(Box::new(cmd_credit_queryall::CommandImpl));
|
|
|
|
c.run()
|
|
}
|