From 1ece339eac894321620a3b6e5d97c16a3add19c6 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Wed, 31 Jan 2024 14:07:28 +0100 Subject: [PATCH] cli: Hint to install ssh-agent --- radicle-cli/examples/rad-auth.md | 2 ++ radicle-cli/src/commands/auth.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/radicle-cli/examples/rad-auth.md b/radicle-cli/examples/rad-auth.md index f3822b87..192fb447 100644 --- a/radicle-cli/examples/rad-auth.md +++ b/radicle-cli/examples/rad-auth.md @@ -10,6 +10,8 @@ Initializing your radicle 👾 identity ✓ Your Radicle DID is did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi. This identifies your device. Run `rad self` to show it at all times. ✓ You're all set. +✗ Hint: install ssh-agent to have it fill in your passphrase for you when signing. + To create a Radicle repository, run `rad init` from a Git repository with at least one commit. To clone a repository, run `rad clone `. For example, `rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5` clones the Radicle 'heartwood' repository. To get a list of all commands, run `rad help`. diff --git a/radicle-cli/src/commands/auth.rs b/radicle-cli/src/commands/auth.rs index fc1a60a1..ffba8b91 100644 --- a/radicle-cli/src/commands/auth.rs +++ b/radicle-cli/src/commands/auth.rs @@ -113,6 +113,7 @@ pub fn init(options: Options) -> anyhow::Result<()> { let passphrase = passphrase.trim().is_empty().not().then_some(passphrase); let spinner = term::spinner("Creating your Ed25519 keypair..."); let profile = Profile::init(home, alias, passphrase.clone())?; + let mut agent = true; spinner.finish(); if let Some(passphrase) = passphrase { @@ -126,7 +127,9 @@ pub fn init(options: Options) -> anyhow::Result<()> { spinner.warn(); } } - Err(e) if e.is_not_running() => {} + Err(e) if e.is_not_running() => { + agent = false; + } Err(e) => Err(e)?, } } @@ -138,6 +141,11 @@ pub fn init(options: Options) -> anyhow::Result<()> { ); term::success!("You're all set."); term::blank(); + + if profile.config.cli.hints && !agent { + term::hint("install ssh-agent to have it fill in your passphrase for you when signing."); + term::blank(); + } term::info!( "To create a Radicle repository, run {} from a Git repository with at least one commit.", term::format::command("rad init")