diff --git a/radicle-cli/examples/rad-auth.md b/radicle-cli/examples/rad-auth.md index 57984d1c..e606146f 100644 --- a/radicle-cli/examples/rad-auth.md +++ b/radicle-cli/examples/rad-auth.md @@ -4,9 +4,9 @@ The example below is run with `RAD_PASSPHRASE` set. ``` $ rad auth -Initializing your 🌱 profile and identity +Initializing your radicle 🌱 identity -✓ Creating your 🌱 Ed25519 keypair... +✓ Creating your Ed25519 keypair... ! Adding your radicle key to ssh-agent... ✓ Your Radicle ID is did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi. This identifies your device. diff --git a/radicle-cli/src/commands/auth.rs b/radicle-cli/src/commands/auth.rs index 0595dccb..7eccabb3 100644 --- a/radicle-cli/src/commands/auth.rs +++ b/radicle-cli/src/commands/auth.rs @@ -66,7 +66,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { } pub fn init(options: Options) -> anyhow::Result<()> { - term::headline("Initializing your 🌱 profile and identity"); + term::headline(format!( + "Initializing your {} 🌱 identity", + term::format::highlight("radicle") + )); if let Ok(version) = radicle::git::version() { if version < radicle::git::VERSION_REQUIRED { @@ -84,9 +87,9 @@ pub fn init(options: Options) -> anyhow::Result<()> { let passphrase = if options.stdin { term::passphrase_stdin() } else { - term::passphrase_confirm() + term::passphrase_confirm("Enter a passphrase:") }?; - let spinner = term::spinner("Creating your 🌱 Ed25519 keypair..."); + let spinner = term::spinner("Creating your Ed25519 keypair..."); let profile = Profile::init(home, passphrase.clone())?; spinner.finish(); @@ -115,7 +118,7 @@ pub fn authenticate(profile: &Profile, options: Options) -> anyhow::Result<()> { let agent = ssh::agent::Agent::connect()?; // TODO: Only show this if we're not authenticated. - term::headline(&format!( + term::headline(format!( "🌱 Authenticating as {}", term::format::Identity::new(profile).styled() )); diff --git a/radicle-cli/src/commands/checkout.rs b/radicle-cli/src/commands/checkout.rs index 068f2b50..d5b3a58d 100644 --- a/radicle-cli/src/commands/checkout.rs +++ b/radicle-cli/src/commands/checkout.rs @@ -80,7 +80,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { let profile = ctx.profile()?; let path = execute(options, &profile)?; - term::headline(&format!( + term::headline(format!( "🌱 Project checkout successful under ./{}", term::format::highlight(path.file_name().unwrap_or_default().to_string_lossy()) )); @@ -105,7 +105,7 @@ pub fn execute(options: Options, profile: &Profile) -> anyhow::Result { anyhow::bail!("the local path {:?} already exists", path.as_path()); } - term::headline(&format!( + term::headline(format!( "Initializing local checkout for 🌱 {} ({})", term::format::highlight(options.id), payload.name(), diff --git a/radicle-cli/src/commands/clone.rs b/radicle-cli/src/commands/clone.rs index 99d71f61..36ecd1a4 100644 --- a/radicle-cli/src/commands/clone.rs +++ b/radicle-cli/src/commands/clone.rs @@ -128,7 +128,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { &delegates, )?; - term::headline(&format!( + term::headline(format!( "🌱 Project successfully cloned under {}", term::format::highlight(Path::new(".").join(path).display()) )); diff --git a/radicle-cli/src/commands/init.rs b/radicle-cli/src/commands/init.rs index 3c0b53dd..7d75f356 100644 --- a/radicle-cli/src/commands/init.rs +++ b/radicle-cli/src/commands/init.rs @@ -159,7 +159,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> let path = path.as_path().canonicalize()?; let interactive = options.interactive; - term::headline(&format!( + term::headline(format!( "Initializing local 🌱 project in {}", if path == cwd { term::format::highlight(".").to_string() @@ -286,7 +286,7 @@ pub fn setup_signing( .ok_or(anyhow!("cannot setup signing in bare repository"))?; let key = ssh::fmt::fingerprint(node_id); let yes = if !git::is_signing_configured(repo)? { - term::headline(&format!( + term::headline(format!( "Configuring 🌱 signing key {}...", term::format::tertiary(key) )); diff --git a/radicle-cli/src/commands/patch/create.rs b/radicle-cli/src/commands/patch/create.rs index 58786649..c8adcb6f 100644 --- a/radicle-cli/src/commands/patch/create.rs +++ b/radicle-cli/src/commands/patch/create.rs @@ -101,7 +101,7 @@ pub fn run( ))?; let head_branch = try_branch(workdir.head()?)?; - term::headline(&format!( + term::headline(format!( "🌱 Creating patch for {}", term::format::highlight(project.name()) )); diff --git a/radicle-cli/src/commands/patch/update.rs b/radicle-cli/src/commands/patch/update.rs index dfac0f2c..d35872fc 100644 --- a/radicle-cli/src/commands/patch/update.rs +++ b/radicle-cli/src/commands/patch/update.rs @@ -95,7 +95,7 @@ pub fn run( // `HEAD`; This is what we are proposing as a patch. let head_branch = try_branch(workdir.head()?)?; - term::headline(&format!( + term::headline(format!( "🌱 Updating patch for {}", term::format::highlight(project.name()) )); diff --git a/radicle-cli/src/terminal/io.rs b/radicle-cli/src/terminal/io.rs index 4856ec1d..efa4235b 100644 --- a/radicle-cli/src/terminal/io.rs +++ b/radicle-cli/src/terminal/io.rs @@ -72,7 +72,7 @@ pub fn columns() -> Option { termion::terminal_size().map(|(cols, _)| cols as usize).ok() } -pub fn headline(headline: &str) { +pub fn headline(headline: impl fmt::Display) { println!(); println!("{}", style(headline).bold()); println!(); @@ -214,16 +214,17 @@ pub fn passphrase() -> Result { } } -pub fn passphrase_confirm() -> Result { +pub fn passphrase_confirm(prompt: &str) -> Result { if let Some(p) = profile::env::passphrase() { Ok(p) } else { Ok(Passphrase::from( - Password::new("Passphrase:") + Password::new(prompt) .with_render_config(*CONFIG) .with_display_mode(inquire::PasswordDisplayMode::Masked) .with_custom_confirmation_message("Repeat passphrase:") .with_custom_confirmation_error_message("The passphrases don't match.") + .with_help_message("This passphrase protects your radicle identity") .prompt()?, )) }