Skip to content

Commit

Permalink
fix fmt type
Browse files Browse the repository at this point in the history
  • Loading branch information
Halimao committed Nov 28, 2023
1 parent b59d91d commit 4876557
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions leo/cli/commands/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,10 @@ fn print_keys(private_key: PrivateKey<CurrentNetwork>) -> Result<()> {
let address = Address::<CurrentNetwork>::try_from(&view_key)?;

display_string_discreetly(
&private_key.to_string(),
&private_key.to_string(),
"### Do not share or lose this private key! Press any key to complete. ###",
)?;
println!(
"\n {:>12} {view_key}\n {:>12} {address}\n",
"View Key".cyan().bold(),
"Address".cyan().bold(),
);
println!("\n {:>12} {view_key}\n {:>12} {address}\n", "View Key".cyan().bold(), "Address".cyan().bold(),);
Ok(())
}

Expand All @@ -121,10 +117,7 @@ fn write_to_env_file(private_key: PrivateKey<CurrentNetwork>, ctx: &Context) ->
}

/// Print the string to an alternate screen, so that the string won't been printed to the terminal.
fn display_string_discreetly(
discreet_string: &str,
continue_message: &str,
) -> Result<()> {
fn display_string_discreetly(discreet_string: &str, continue_message: &str) -> Result<()> {
use termion::screen::IntoAlternateScreen;
let mut screen = std::io::stdout().into_alternate_screen().unwrap();
writeln!(screen, "{discreet_string}").unwrap();
Expand All @@ -137,4 +130,4 @@ fn display_string_discreetly(
fn wait_for_keypress() {
let mut single_key = [0u8];
std::io::stdin().read_exact(&mut single_key).unwrap();
}
}

0 comments on commit 4876557

Please sign in to comment.