cli: Cleanup patch, checkout and clone output

Remove extra whitespace, start moving away from sprout.
This commit is contained in:
Alexis Sellier 2023-04-10 14:15:51 +02:00
parent c8e548fb1d
commit 9db63a8801
No known key found for this signature in database
8 changed files with 13 additions and 36 deletions

View File

@ -3,13 +3,7 @@ existing project.
``` ```
$ rad checkout rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji $ rad checkout rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Repository checkout successful under ./heartwood
Initializing local checkout for 🌱 rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji (heartwood)
✓ Performing checkout...
🌱 Project checkout successful under ./heartwood
``` ```
Let's have a look at what the command did. Navigate to the working copy: Let's have a look at what the command did. Navigate to the working copy:

View File

@ -9,9 +9,7 @@ $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Creating checkout in ./heartwood.. ✓ Creating checkout in ./heartwood..
✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created ✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created
✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi ✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
🌱 Project successfully cloned under [..]/heartwood/
``` ```
We can now have a look at the new working copy that was created from the cloned We can now have a look at the new working copy that was created from the cloned

View File

@ -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." $ rad patch open --message "Define power requirements" --message "See details."
master <- z6MknSLStBU8Vi/flux-capacitor-power (3e674d1) master <- z6MknSLStBU8Vi/flux-capacitor-power (3e674d1)
1 commit(s) ahead, 0 commit(s) behind 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: To publish your patch to the network, run:
rad push rad push
``` ```
It will now be listed as one of the project's open patches. It will now be listed as one of the project's open patches.

View File

@ -9,9 +9,7 @@ $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Creating checkout in ./heartwood.. ✓ Creating checkout in ./heartwood..
✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created ✓ Remote z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi created
✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi ✓ Remote-tracking branch z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
🌱 Project successfully cloned under [..]/heartwood/
``` ```
We can now have a look at the new working copy that was created from the cloned We can now have a look at the new working copy that was created from the cloned

View File

@ -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." $ rad patch open --message "Define power requirements" --message "See details."
master <- z6Mkt67v4N1tRk/flux-capacitor-power (3e674d1) master <- z6Mkt67v4N1tRk/flux-capacitor-power (3e674d1)
1 commit(s) ahead, 0 commit(s) behind 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: To publish your patch to the network, run:
rad push rad push
``` ```
It will now be listed as one of the project's open patches. It will now be listed as one of the project's open patches.

View File

@ -70,17 +70,12 @@ impl Args for Options {
pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let profile = ctx.profile()?; let profile = ctx.profile()?;
let path = execute(options, &profile)?; execute(options, &profile)?;
term::headline(format!(
"🌱 Project checkout successful under ./{}",
term::format::highlight(path.file_name().unwrap_or_default().to_string_lossy())
));
Ok(()) Ok(())
} }
pub fn execute(options: Options, profile: &Profile) -> anyhow::Result<PathBuf> { fn execute(options: Options, profile: &Profile) -> anyhow::Result<PathBuf> {
let id = options.id; let id = options.id;
let storage = &profile.storage; let storage = &profile.storage;
let remote = options.remote.unwrap_or(profile.did()); let remote = options.remote.unwrap_or(profile.did());
@ -97,13 +92,7 @@ pub fn execute(options: Options, profile: &Profile) -> anyhow::Result<PathBuf> {
anyhow::bail!("the local path {:?} already exists", path.as_path()); anyhow::bail!("the local path {:?} already exists", path.as_path());
} }
term::headline(format!( let mut spinner = term::spinner("Performing checkout...");
"Initializing local checkout for 🌱 {} ({})",
term::format::highlight(options.id),
payload.name(),
));
let spinner = term::spinner("Performing checkout...");
let repo = match radicle::rad::checkout(options.id, &remote, path.clone(), &storage) { let repo = match radicle::rad::checkout(options.id, &remote, path.clone(), &storage) {
Ok(repo) => repo, Ok(repo) => repo,
Err(err) => { Err(err) => {
@ -113,6 +102,10 @@ pub fn execute(options: Options, profile: &Profile) -> anyhow::Result<PathBuf> {
return Err(err.into()); 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(); spinner.finish();
let remotes = doc let remotes = doc

View File

@ -129,10 +129,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
&delegates, &delegates,
)?; )?;
term::headline(format!( term::success!(
"🌱 Project successfully cloned under {}", "Repository successfully cloned under {}",
term::format::highlight(Path::new(".").join(path).display()) term::format::highlight(Path::new(".").join(path).display())
)); );
Ok(()) Ok(())
} }

View File

@ -58,7 +58,6 @@ fn show_patch_commit_info(
let base_oid = workdir.merge_base(*target_oid, *head_oid)?; let base_oid = workdir.merge_base(*target_oid, *head_oid)?;
let commits = patch_commits(workdir, &base_oid, &head_oid)?; let commits = patch_commits(workdir, &base_oid, &head_oid)?;
term::blank();
term::info!( term::info!(
"{} <- {}/{} ({})", "{} <- {}/{} ({})",
term::format::highlight(target_ref), term::format::highlight(target_ref),
@ -134,7 +133,6 @@ pub fn run(
} else { } else {
term::info!("To publish your patch to the network, run:"); term::info!("To publish your patch to the network, run:");
term::indented(term::format::secondary("rad push")); term::indented(term::format::secondary("rad push"));
term::blank();
} }
Ok(()) Ok(())