Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: command default print help #13

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!(),
}
}