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

fix: use stderr for cli messages #4022

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 13 additions & 11 deletions api/bin/chainflip-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ fn generate_keys(json: bool, path: Option<PathBuf>, seed_phrase: Option<String>)
if json {
println!("{}", serde_json::to_string_pretty(&keys)?);
} else {
println!();
println!("Generated fresh Validator keys for your Chainflip Node!");
println!();
println!("{}", keys);
println!("{}", DISCLAIMER);
eprintln!();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use \n instead of the empty printlns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 It's nicer to read? Keeps everything in line etc...

eprintln!("Generated fresh Validator keys for your Chainflip Node!");
eprintln!();
eprintln!("{}", keys);
eprintln!("{}", DISCLAIMER);
}

if let Some(path) = path {
Expand All @@ -348,12 +348,14 @@ fn generate_keys(json: bool, path: Option<PathBuf>, seed_phrase: Option<String>)
.context("Error while writing to file.")?;
}

println!();
println!("💾 Saved all secret keys to '{}'.", path.display());
} else if !json {
println!();
println!("💡 You can save the private key files to a directory using the --path argument:");
println!("💡 `chainflip-cli --seed-phrase $MY_SEED_PHRASE --path $PATH_TO_KEYS_DIR`");
eprintln!();
eprintln!(" 💾 Saved all secret keys to '{}'.", path.display());
} else {
eprintln!();
eprintln!(
"💡 You can save the private key files to a directory using the --path argument:"
);
eprintln!("💡 `chainflip-cli --seed-phrase $MY_SEED_PHRASE --path $PATH_TO_KEYS_DIR`");
}

Ok(())
Expand Down