From 9db63a88019a26d088949c4c27a37725f0ad20f3 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 10 Apr 2023 14:15:51 +0200 Subject: [PATCH] cli: Cleanup patch, checkout and clone output Remove extra whitespace, start moving away from sprout. --- radicle-cli/examples/rad-checkout.md | 8 +------ radicle-cli/examples/rad-clone.md | 4 +--- radicle-cli/examples/rad-patch.md | 2 -- radicle-cli/examples/workflow/2-cloning.md | 4 +--- .../workflow/4-patching-contributor.md | 2 -- radicle-cli/src/commands/checkout.rs | 21 +++++++------------ radicle-cli/src/commands/clone.rs | 6 +++--- radicle-cli/src/commands/patch/create.rs | 2 -- 8 files changed, 13 insertions(+), 36 deletions(-) diff --git a/radicle-cli/examples/rad-checkout.md b/radicle-cli/examples/rad-checkout.md index 4477493f..2b9b2e4f 100644 --- a/radicle-cli/examples/rad-checkout.md +++ b/radicle-cli/examples/rad-checkout.md @@ -3,13 +3,7 @@ existing project. ``` $ rad checkout rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji - -Initializing local checkout for 🌱 rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji (heartwood) - -✓ Performing checkout... - -🌱 Project checkout successful under ./heartwood - +✓ Repository checkout successful under ./heartwood ``` Let's have a look at what the command did. Navigate to the working copy: diff --git a/radicle-cli/examples/rad-clone.md b/radicle-cli/examples/rad-clone.md index 27c62a29..dc35eba4 100644 --- a/radicle-cli/examples/rad-clone.md +++ b/radicle-cli/examples/rad-clone.md @@ -9,9 +9,7 @@ $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ✓ Creating checkout in ./heartwood.. ✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created ✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi - -🌱 Project successfully cloned under [..]/heartwood/ - +✓ Repository successfully cloned under [..]/heartwood/ ``` We can now have a look at the new working copy that was created from the cloned diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index 20a21853..a7f236c2 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -26,7 +26,6 @@ Once the code is ready, we open (or create) a patch with our changes for the pro ``` $ rad patch open --message "Define power requirements" --message "See details." - master <- z6MknSL…StBU8Vi/flux-capacitor-power (3e674d1) 1 commit(s) ahead, 0 commit(s) behind @@ -36,7 +35,6 @@ master <- z6MknSL…StBU8Vi/flux-capacitor-power (3e674d1) To publish your patch to the network, run: rad push - ``` It will now be listed as one of the project's open patches. diff --git a/radicle-cli/examples/workflow/2-cloning.md b/radicle-cli/examples/workflow/2-cloning.md index 70ed7ca6..656e473f 100644 --- a/radicle-cli/examples/workflow/2-cloning.md +++ b/radicle-cli/examples/workflow/2-cloning.md @@ -9,9 +9,7 @@ $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ✓ Creating checkout in ./heartwood.. ✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created ✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi - -🌱 Project successfully cloned under [..]/heartwood/ - +✓ Repository successfully cloned under [..]/heartwood/ ``` We can now have a look at the new working copy that was created from the cloned diff --git a/radicle-cli/examples/workflow/4-patching-contributor.md b/radicle-cli/examples/workflow/4-patching-contributor.md index 1fd40246..1ff7fe5e 100644 --- a/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/radicle-cli/examples/workflow/4-patching-contributor.md @@ -26,7 +26,6 @@ Once the code is ready, we open a patch with our changes. ``` $ rad patch open --message "Define power requirements" --message "See details." - master <- z6Mkt67…v4N1tRk/flux-capacitor-power (3e674d1) 1 commit(s) ahead, 0 commit(s) behind @@ -36,7 +35,6 @@ master <- z6Mkt67…v4N1tRk/flux-capacitor-power (3e674d1) To publish your patch to the network, run: rad push - ``` It will now be listed as one of the project's open patches. diff --git a/radicle-cli/src/commands/checkout.rs b/radicle-cli/src/commands/checkout.rs index 3c7509e6..6ab3a9d5 100644 --- a/radicle-cli/src/commands/checkout.rs +++ b/radicle-cli/src/commands/checkout.rs @@ -70,17 +70,12 @@ impl Args for Options { pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { let profile = ctx.profile()?; - let path = execute(options, &profile)?; - - term::headline(format!( - "🌱 Project checkout successful under ./{}", - term::format::highlight(path.file_name().unwrap_or_default().to_string_lossy()) - )); + execute(options, &profile)?; Ok(()) } -pub fn execute(options: Options, profile: &Profile) -> anyhow::Result { +fn execute(options: Options, profile: &Profile) -> anyhow::Result { let id = options.id; let storage = &profile.storage; let remote = options.remote.unwrap_or(profile.did()); @@ -97,13 +92,7 @@ pub fn execute(options: Options, profile: &Profile) -> anyhow::Result { anyhow::bail!("the local path {:?} already exists", path.as_path()); } - term::headline(format!( - "Initializing local checkout for 🌱 {} ({})", - term::format::highlight(options.id), - payload.name(), - )); - - let spinner = term::spinner("Performing checkout..."); + let mut spinner = term::spinner("Performing checkout..."); let repo = match radicle::rad::checkout(options.id, &remote, path.clone(), &storage) { Ok(repo) => repo, Err(err) => { @@ -113,6 +102,10 @@ pub fn execute(options: Options, profile: &Profile) -> anyhow::Result { return Err(err.into()); } }; + spinner.message(format!( + "Repository checkout successful under ./{}", + term::format::highlight(path.file_name().unwrap_or_default().to_string_lossy()) + )); spinner.finish(); let remotes = doc diff --git a/radicle-cli/src/commands/clone.rs b/radicle-cli/src/commands/clone.rs index 745b2ea5..58ea293d 100644 --- a/radicle-cli/src/commands/clone.rs +++ b/radicle-cli/src/commands/clone.rs @@ -129,10 +129,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { &delegates, )?; - term::headline(format!( - "🌱 Project successfully cloned under {}", + term::success!( + "Repository successfully cloned under {}", term::format::highlight(Path::new(".").join(path).display()) - )); + ); Ok(()) } diff --git a/radicle-cli/src/commands/patch/create.rs b/radicle-cli/src/commands/patch/create.rs index 4253b7c0..95d542b8 100644 --- a/radicle-cli/src/commands/patch/create.rs +++ b/radicle-cli/src/commands/patch/create.rs @@ -58,7 +58,6 @@ fn show_patch_commit_info( let base_oid = workdir.merge_base(*target_oid, *head_oid)?; let commits = patch_commits(workdir, &base_oid, &head_oid)?; - term::blank(); term::info!( "{} <- {}/{} ({})", term::format::highlight(target_ref), @@ -134,7 +133,6 @@ pub fn run( } else { term::info!("To publish your patch to the network, run:"); term::indented(term::format::secondary("rad push")); - term::blank(); } Ok(())