Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Update some of the output formatting
Alexis Sellier committed 3 years ago
commit e7cc32a2788b8284557de0a698e68ab0fbf0d72d
parent dd7d86abb0910bf484d3508043ffabde7714fe65
8 files changed +29 -19
modified radicle-cli/examples/rad-auth.md
@@ -9,7 +9,7 @@ Initializing your radicle 👾 identity
✓ Creating your Ed25519 keypair...
✓ Your Radicle ID is did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi. This identifies your device.

-
👉 To create a radicle project, run `rad init` from a git repository.
+
To create a radicle project, run `rad init` from a git repository.
```

You can get the above information at all times using the `self` command:
modified radicle-cli/examples/rad-id-rebase.md
@@ -186,7 +186,7 @@ Now, when we go to accept the second proposal:
$ rad id accept 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --no-confirm
! Warning: Revision is out of date
! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
-
👉 Consider using 'rad id rebase' to update the proposal to the latest identity
+
* Consider using 'rad id rebase' to update the proposal to the latest identity
✓ Accepted proposal ✓
title: Add Bob
description: Add Bob as a delegate
@@ -231,9 +231,9 @@ Quorum Reached

Note that a warning was emitted:

-
    ** Warning: Revision is out of date
-
    ** Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
-
    => Consider using 'rad id rebase' to update the proposal to the latest identity
+
    ! Warning: Revision is out of date
+
    ! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
+
    * Consider using 'rad id rebase' to update the proposal to the latest identity

If we attempt to commit this revision, the command will fail:

@@ -241,7 +241,7 @@ If we attempt to commit this revision, the command will fail:
$ rad id commit 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --no-confirm
! Warning: Revision is out of date
! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
-
👉 Consider using 'rad id rebase' to update the proposal to the latest identity
+
* Consider using 'rad id rebase' to update the proposal to the latest identity
✗ Id failed: the identity hashes do match 'd96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f' for the revision '3f6ae4f8645c8b0cbcd35ea924df7b13aca52774'
```

modified radicle-cli/examples/rad-init-sync.md
@@ -12,6 +12,5 @@ Initializing radicle 👾 project in .
✓ Announcing inventory..

Your project's Repository ID (RID) is rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji.
-
You can show it any time by running:
-
    rad .
+
You can show it any time by running `rad .`
```
modified radicle-cli/examples/rad-init.md
@@ -15,11 +15,9 @@ Initializing radicle 👾 project in .
}

Your project's Repository ID (RID) is rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji.
-
You can show it any time by running:
-
    rad .
+
You can show it any time by running `rad .`

-
To publish your project to the network, run:
-
    git push
+
To publish your project to the network, run `git push`
```

Projects can be listed with the `ls` command:
modified radicle-cli/src/commands/auth.rs
@@ -111,9 +111,9 @@ pub fn init(options: Options) -> anyhow::Result<()> {
    );

    term::blank();
-
    term::tip!(
+
    term::info!(
        "To create a radicle project, run {} from a git repository.",
-
        term::format::secondary("`rad init`")
+
        term::format::command("rad init")
    );

    Ok(())
modified radicle-cli/src/commands/init.rs
@@ -276,13 +276,17 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
                term::format::dim("(RID)"),
                term::format::highlight(id.urn())
            );
-
            term::info!("You can show it any time by running:");
-
            term::indented(term::format::secondary("rad ."));
+
            term::info!(
+
                "You can show it any time by running {}",
+
                term::format::command("rad .")
+
            );

            if !options.announce {
                term::blank();
-
                term::info!("To publish your project to the network, run:");
-
                term::indented(term::format::secondary(push_cmd));
+
                term::info!(
+
                    "To publish your project to the network, run {}",
+
                    term::format::command(push_cmd)
+
                );
            }
        }
        Err(err) => {
modified radicle-cli/src/terminal/format.rs
@@ -29,6 +29,11 @@ pub fn parens<D: fmt::Display>(input: Paint<D>) -> Paint<String> {
    Paint::new(format!("({})", input.item)).with_style(input.style)
}

+
/// Format a command suggestion, eg. `rad init`.
+
pub fn command<D: fmt::Display>(cmd: D) -> Paint<String> {
+
    primary(format!("`{cmd}`"))
+
}
+

/// Format a COB id.
pub fn cob(id: &ObjectId) -> String {
    format!("{:.7}", id.to_string())
modified radicle-term/src/io.rs
@@ -73,7 +73,11 @@ pub fn success_args(args: fmt::Arguments) {
}

pub fn tip_args(args: fmt::Arguments) {
-
    println!("👉 {}", style(format!("{args}")).italic());
+
    println!(
+
        "{} {}",
+
        format::yellow("*"),
+
        style(format!("{args}")).italic()
+
    );
}

pub fn notice_args(args: fmt::Arguments) {