Print usage is a command is not provided

This commit is contained in:
Greg Fitzgerald 2018-06-29 16:04:35 -06:00 committed by Greg Fitzgerald
parent c4b62e19f2
commit 7b5b989cfe
1 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ impl Default for WalletConfig {
fn print_usage(program: &str, opts: Options) { fn print_usage(program: &str, opts: Options) {
let mut brief = format!("Usage: {} [options]\n\n", program); let mut brief = format!("Usage: {} [options]\n\n", program);
brief += " solana-wallet allows you to perform basic actions, including\n"; brief += " solana-wallet allows you to perform basic actions, including";
brief += " requesting an airdrop, checking your balance, and spending tokens."; brief += " requesting an airdrop, checking your balance, and spending tokens.";
brief += " Takes json formatted mint file to stdin."; brief += " Takes json formatted mint file to stdin.";
@ -110,7 +110,7 @@ fn parse_args(args: Vec<String>) -> Result<WalletConfig, Box<error::Error>> {
} }
}; };
if matches.opt_present("h") { if matches.opt_present("h") || matches.free.len() < 1 {
let program = args[0].clone(); let program = args[0].clone();
print_usage(&program, opts); print_usage(&program, opts);
display_actions(); display_actions();
@ -232,10 +232,11 @@ fn process_command(
fn display_actions() { fn display_actions() {
println!(""); println!("");
println!(" `balance` - Get your account balance"); println!("Commands:");
println!(" `airdrop` - Request a batch of tokens"); println!(" balance Get your account balance");
println!(" `pay` - Spend your tokens as fast as possible"); println!(" airdrop Request a batch of tokens");
println!(" `confirm` - Confirm your last payment by signature"); println!(" pay Spend your tokens as fast as possible");
println!(" confirm Confirm your last payment by signature");
println!(""); println!("");
} }