cli: Update some of the output formatting

This commit is contained in:
Alexis Sellier 2023-05-12 13:09:42 +02:00
parent dd7d86abb0
commit e7cc32a278
No known key found for this signature in database
8 changed files with 29 additions and 19 deletions

View File

@ -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:

View File

@ -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'
```

View File

@ -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 .`
```

View File

@ -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:

View File

@ -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(())

View File

@ -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) => {

View File

@ -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())

View File

@ -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) {