Skip to content

Commit

Permalink
Print usage is a command is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
garious committed Jun 29, 2018
1 parent c4b62e1 commit 7b5b989
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/bin/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Default for WalletConfig {

fn print_usage(program: &str, opts: Options) {
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 += " Takes json formatted mint file to stdin.";

Expand Down Expand Up @@ -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();
print_usage(&program, opts);
display_actions();
Expand Down Expand Up @@ -232,10 +232,11 @@ fn process_command(

fn display_actions() {
println!("");
println!(" `balance` - Get your account balance");
println!(" `airdrop` - Request a batch of tokens");
println!(" `pay` - Spend your tokens as fast as possible");
println!(" `confirm` - Confirm your last payment by signature");
println!("Commands:");
println!(" balance Get your account balance");
println!(" airdrop Request a batch of tokens");
println!(" pay Spend your tokens as fast as possible");
println!(" confirm Confirm your last payment by signature");
println!("");
}

Expand Down

0 comments on commit 7b5b989

Please sign in to comment.