Skip to content

Commit

Permalink
feat: command default print help (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsoledad authored and doitian committed Nov 21, 2018
1 parent 77c216e commit 1bbb3d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/cli/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: ckb
author: Nervos Core Dev <dev@nervos.org>
about: Nervos CKB - The Common Knowledge Base

settings:
- ArgRequiredElseHelp
subcommands:
- run:
about: Running ckb node
Expand Down Expand Up @@ -78,6 +80,8 @@ subcommands:
required: true
- cli:
about: Running ckb cli
settings:
- ArgRequiredElseHelp
subcommands:
- sign:
about: Sign transaction using sha3-secp256k1 defined in system cell
Expand Down
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ mod cli;
mod helper;
mod setup;

use build_info::Version;
use setup::Setup;

pub const DEFAULT_CONFIG_FILENAME: &str = "config.json";
pub const DEFAULT_CONFIG: &str = include_str!("config/default.json");
use build_info::Version;

fn main() {
// Always print backtrace on panic.
Expand All @@ -63,14 +64,14 @@ fn main() {
Err(e) => println!("Failed to setup, cause err {}", e.description()),
},
("keygen", _) => cli::keygen(),
_ => println!("Invalid client subcommand"),
_ => unreachable!(),
},
("run", Some(run_matches)) => match Setup::new(&run_matches) {
Ok(setup) => cli::run(setup),
Err(e) => println!("Failed to setup, cause err {}", e.description()),
},
("export", Some(export_matches)) => cli::export(&export_matches),
("import", Some(import_matches)) => cli::import(&import_matches),
_ => println!("Invalid subcommand"),
_ => unreachable!(),
}
}

0 comments on commit 1bbb3d0

Please sign in to comment.