diff --git a/radicle-cli/examples/rad-rm.md b/radicle-cli/examples/rad-rm.md index 024df617..7cf84c25 100644 --- a/radicle-cli/examples/rad-rm.md +++ b/radicle-cli/examples/rad-rm.md @@ -12,7 +12,7 @@ Now let's delete the `heartwood` project: $ rad rm rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-confirm ! Warning: Failed to untrack repository: failed to connect to node: No such file or directory (os error 2) ! Warning: Make sure to untrack this repository when your node is running -✓ Successfully removed project rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from storage +✓ Successfully removed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from storage ``` We can check our repositories again to see if it was deleted: diff --git a/radicle-cli/src/commands/rm.rs b/radicle-cli/src/commands/rm.rs index 05dd0ae7..543f74fe 100644 --- a/radicle-cli/src/commands/rm.rs +++ b/radicle-cli/src/commands/rm.rs @@ -76,18 +76,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { if let Ok(Some(_)) = storage.get(signer.public_key(), id.to_owned()) { let path = radicle::storage::git::paths::repository(storage, &id); - if !options.confirm - || term::confirm(format!( - "Are you sure you would like to delete {}?", - term::format::dim(id.urn()) - )) - { + if !options.confirm || term::confirm(format!("Remove {id}?")) { if let Err(e) = rad_untrack::untrack(id.to_owned(), &profile) { term::warning(&format!("Failed to untrack repository: {e}")); term::warning("Make sure to untrack this repository when your node is running"); } fs::remove_dir_all(path)?; - term::success!("Successfully removed project {id} from storage"); + term::success!("Successfully removed {id} from storage"); } } else { anyhow::bail!("project {} does not exist", &id) diff --git a/radicle-cli/src/terminal/format.rs b/radicle-cli/src/terminal/format.rs index a72b8dbb..3ae7f4c3 100644 --- a/radicle-cli/src/terminal/format.rs +++ b/radicle-cli/src/terminal/format.rs @@ -88,6 +88,10 @@ impl<'a> fmt::Display for Identity<'a> { } } +pub fn wrap(msg: D) -> Paint { + Paint::wrapping(msg) +} + pub fn negative(msg: D) -> Paint { Paint::red(msg).bold() } diff --git a/radicle-cli/src/terminal/io.rs b/radicle-cli/src/terminal/io.rs index db3e5b97..0dfeac64 100644 --- a/radicle-cli/src/terminal/io.rs +++ b/radicle-cli/src/terminal/io.rs @@ -158,20 +158,21 @@ pub fn fail(header: &str, error: &anyhow::Error) { } pub fn ask(prompt: D, default: bool) -> bool { - let prompt = format!("{} {}", Paint::blue("?".to_owned()), prompt); + let prompt = prompt.to_string(); Confirm::new(&prompt) .with_default(default) + .with_render_config(*CONFIG) .prompt() .unwrap_or_default() } pub fn confirm(prompt: D) -> bool { - ask(format::tertiary(prompt), true) + ask(prompt, true) } pub fn abort(prompt: D) -> bool { - ask(format::tertiary(prompt), false) + ask(prompt, false) } /// Get the signer. First we try getting it from ssh-agent, otherwise we prompt the user.