cli: Improve patch and issue outputs

* Add author to `issue show`
* Improve author display with alias
* Fix consistency issues when printing authors
This commit is contained in:
cloudhead 2023-08-30 20:34:23 +02:00
parent aec865a986
commit 6c5cba3ca6
No known key found for this signature in database
19 changed files with 293 additions and 312 deletions

View File

@ -8,6 +8,7 @@ $ rad issue open --title "flux capacitor underpowered" --description "Flux capac
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │ │ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │ │ Status open │
│ │ │ │
│ Flux capacitor power requirements exceed current supply │ │ Flux capacitor power requirements exceed current supply │
@ -32,6 +33,7 @@ $ rad issue show 42028af
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │ │ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │ │ Status open │
│ │ │ │
│ Flux capacitor power requirements exceed current supply │ │ Flux capacitor power requirements exceed current supply │

View File

@ -12,6 +12,7 @@ $ rad issue show 42028af21fabc09bfac2f25490f119f7c7e11542
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │ │ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │
│ Author z6MknSL…StBU8Vi (you) │
│ Labels bug, good-first-issue │ │ Labels bug, good-first-issue │
│ Status open │ │ Status open │
│ │ │ │
@ -32,6 +33,7 @@ $ rad issue show 42028af21fabc09bfac2f25490f119f7c7e11542
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │ │ Issue 42028af21fabc09bfac2f25490f119f7c7e11542 │
│ Author z6MknSL…StBU8Vi (you) │
│ Labels bug │ │ Labels bug │
│ Status open │ │ Status open │
│ │ │ │

View File

@ -66,12 +66,12 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
``` ```
``` ```
$ rad patch --merged $ rad patch --merged
╭──────────────────────────────────────────────────────────────────────────────────────── ╭─────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │ │ ● ID Title Author Head + - Updated │
├──────────────────────────────────────────────────────────────────────────────────────── ├─────────────────────────────────────────────────────────────────────────┤
│ ✔ 143bb0c First change z6MknSL…StBU8Vi alice (you) 20aa5dd +0 -0 [ ... ] │ │ ✔ 143bb0c First change alice (you) 20aa5dd +0 -0 [ ... ] │
│ ✔ 5d0e608 Second change z6MknSL…StBU8Vi alice (you) daf349f +0 -0 [ ... ] │ │ ✔ 5d0e608 Second change alice (you) daf349f +0 -0 [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────────────── ╰─────────────────────────────────────────────────────────────────────────╯
``` ```
We can verify that the remote tracking branches were also deleted: We can verify that the remote tracking branches were also deleted:

View File

@ -56,20 +56,20 @@ When showing the patch, we see that it is `ahead 1, behind 1`, since master has
diverged by one commit: diverged by one commit:
``` ```
$ rad patch show -v -p 69ebafb $ rad patch show -v -p 69ebafb
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Add Alan │ Title Add Alan │
│ Patch 69ebafb6f654fb29d23f630cc165d83d6cbf525c │ Patch 69ebafb6f654fb29d23f630cc165d83d6cbf525c │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
│ Branches feature/1 │ Branches feature/1 │
│ Commits ahead 1, behind 1 │ Commits ahead 1, behind 1 │
│ Status open │ Status open │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 5c88a79 Add Alan │ 5c88a79 Add Alan │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
commit 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 commit 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7
Author: radicle <radicle@localhost> Author: radicle <radicle@localhost>
@ -102,21 +102,21 @@ When we look at the patch, we see that it has both commits, because this new
patch uses the same base as the previous patch: patch uses the same base as the previous patch:
``` ```
$ rad patch show -v 53d5f17aba5fd9b7de7a02ecb6f01de561701eeb $ rad patch show -v 53d5f17aba5fd9b7de7a02ecb6f01de561701eeb
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Add Mel │ Title Add Mel │
│ Patch 53d5f17aba5fd9b7de7a02ecb6f01de561701eeb │ Patch 53d5f17aba5fd9b7de7a02ecb6f01de561701eeb │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
│ Branches feature/2 │ Branches feature/2 │
│ Commits ahead 2, behind 1 │ Commits ahead 2, behind 1 │
│ Status open │ Status open │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 7f63fcb Add Mel │ 7f63fcb Add Mel │
│ 5c88a79 Add Alan │ 5c88a79 Add Alan │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
If we want to instead create a "stacked" patch, we can do so with the If we want to instead create a "stacked" patch, we can do so with the
@ -137,18 +137,18 @@ that it is still two commits ahead and one behind from `master`.
``` ```
$ rad patch show -v 459dc67a024ff30c3bca02f0f1e5b746459ce32a $ rad patch show -v 459dc67a024ff30c3bca02f0f1e5b746459ce32a
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Add Mel #2 │ Title Add Mel #2
│ Patch 459dc67a024ff30c3bca02f0f1e5b746459ce32a │ Patch 459dc67a024ff30c3bca02f0f1e5b746459ce32a │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
│ Base 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │ Base 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
│ Branches feature/2 │ Branches feature/2 │
│ Commits ahead 2, behind 1 │ Commits ahead 2, behind 1 │
│ Status open │ Status open │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 7f63fcb Add Mel │ 7f63fcb Add Mel │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```

View File

@ -18,19 +18,19 @@ We can confirm it's a draft by running `show`:
``` ```
$ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 $ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Nothing yet │ Title Nothing yet │
│ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │ Branches cloudhead/draft │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status draft │ Status draft │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here.. │ 2a46583 Nothing to see here.. │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
Once the patch is ready for review, we can use the `ready` command: Once the patch is ready for review, we can use the `ready` command:
@ -41,19 +41,19 @@ $ rad patch ready 79a1a5138b7f91c6dead5544ecde285dc3d0cb45
``` ```
$ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 $ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Nothing yet │ Title Nothing yet │
│ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │ Branches cloudhead/draft │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status open │ Status open │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here.. │ 2a46583 Nothing to see here.. │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
If for whatever reason, it needed to go back into draft mode, we could use If for whatever reason, it needed to go back into draft mode, we could use
@ -62,16 +62,16 @@ the `--undo` flag:
``` ```
$ rad patch ready --undo 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 $ rad patch ready --undo 79a1a5138b7f91c6dead5544ecde285dc3d0cb45
$ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 $ rad patch show 79a1a5138b7f91c6dead5544ecde285dc3d0cb45
╭───────────────────────────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Nothing yet │ Title Nothing yet │
│ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │ Patch 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │ Branches cloudhead/draft │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status draft │ Status draft │
├───────────────────────────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here.. │ 2a46583 Nothing to see here.. │
├───────────────────────────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰───────────────────────────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯

View File

@ -88,7 +88,7 @@ $ rad patch show 26e3e56
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Bob's patch │ │ Title Bob's patch │
│ Patch 26e3e563ddc7df8dd0c9f81274c0b3cb1b764568 │ │ Patch 26e3e563ddc7df8dd0c9f81274c0b3cb1b764568 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ Author bob z6Mkt67…v4N1tRk
│ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │ │ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
│ Status open │ │ Status open │
@ -96,7 +96,7 @@ $ rad patch show 26e3e56
│ cad2666 Bob's commit #2 │ cad2666 Bob's commit #2
│ bdcdb30 Bob's commit #1 │ bdcdb30 Bob's commit #1
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by bob (z6Mkt67…v4N1tRk) [ ... ] │ │ ● opened by bob z6Mkt67…v4N1tRk [ ... ]
│ ↑ updated to c04ef81bad734c65a7d5834cefcdd60c4f0484f7 (cad2666) [ ... ] │ │ ↑ updated to c04ef81bad734c65a7d5834cefcdd60c4f0484f7 (cad2666) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
$ git ls-remote rad $ git ls-remote rad

View File

@ -13,19 +13,19 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
``` ```
$ rad patch show ea6fa6c274c55d0f4fdf203a192cbf1330b51221 $ rad patch show ea6fa6c274c55d0f4fdf203a192cbf1330b51221
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Not a real change │ Title Not a real change │
│ Patch ea6fa6c274c55d0f4fdf203a192cbf1330b51221 │ Patch ea6fa6c274c55d0f4fdf203a192cbf1330b51221 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │ Head 51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
│ Branches feature/1 │ Branches feature/1 │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status open │ Status open │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 51b2f0f Not a real change │ 51b2f0f Not a real change │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
We can make some changes to the repository: We can make some changes to the repository:
@ -57,7 +57,7 @@ $ rad patch show ea6fa6c274c55d0f4fdf203a192cbf1330b51221
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Not a real change │ │ Title Not a real change │
│ Patch ea6fa6c274c55d0f4fdf203a192cbf1330b51221 │ │ Patch ea6fa6c274c55d0f4fdf203a192cbf1330b51221 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 4d272148458a17620541555b1f0905c01658aa9f │ │ Head 4d272148458a17620541555b1f0905c01658aa9f │
│ Branches feature/1 │ │ Branches feature/1 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
@ -66,7 +66,7 @@ $ rad patch show ea6fa6c274c55d0f4fdf203a192cbf1330b51221
│ 4d27214 Rename readme file │ │ 4d27214 Rename readme file │
│ 51b2f0f Not a real change │ │ 51b2f0f Not a real change │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ]
│ ↑ updated to 59bbb5c5d3c9f18a686113e6354b1372eebafda4 (4d27214) [ ... ] │ │ ↑ updated to 59bbb5c5d3c9f18a686113e6354b1372eebafda4 (4d27214) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
``` ```

View File

@ -17,21 +17,21 @@ We can see a patch was created:
``` ```
$ rad patch show 90c77f2 $ rad patch show 90c77f2
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Add things #1 │ Title Add things #1
│ Patch 90c77f2c33b7e472e058de4a586156f8a7fec7d6 │ Patch 90c77f2c33b7e472e058de4a586156f8a7fec7d6 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │
│ Branches feature/1 │ Branches feature/1 │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status open │ Status open │
│ │
│ See commits for details. │ See commits for details. │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 42d894a Add things │ 42d894a Add things │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
If we check our local branch, we can see its upstream is set to track a remote If we check our local branch, we can see its upstream is set to track a remote
@ -132,7 +132,7 @@ $ rad patch show fedf0e4
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Add more things │ │ Title Add more things │
│ Patch fedf0e4dcb74ff6db1d5e30a6a254b77f02ff60b │ │ Patch fedf0e4dcb74ff6db1d5e30a6a254b77f02ff60b │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f │ │ Head 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f │
│ Branches feature/2 │ │ Branches feature/2 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
@ -141,7 +141,7 @@ $ rad patch show fedf0e4
│ 02bef3f Improve code │ │ 02bef3f Improve code │
│ 8b0ea80 Add more things │ │ 8b0ea80 Add more things │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
│ ↑ updated to d0018fcc21d87c91a1ff9155aed6b4e57535566b (02bef3f) [ ... ] │ │ ↑ updated to d0018fcc21d87c91a1ff9155aed6b4e57535566b (02bef3f) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
``` ```
@ -208,7 +208,7 @@ $ rad patch show fedf0e4
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Add more things │ │ Title Add more things │
│ Patch fedf0e4dcb74ff6db1d5e30a6a254b77f02ff60b │ │ Patch fedf0e4dcb74ff6db1d5e30a6a254b77f02ff60b │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 9304dbc445925187994a7a93222a3f8bde73b785 │ │ Head 9304dbc445925187994a7a93222a3f8bde73b785 │
│ Branches feature/2 │ │ Branches feature/2 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
@ -217,7 +217,7 @@ $ rad patch show fedf0e4
│ 9304dbc Amended commit │ │ 9304dbc Amended commit │
│ 8b0ea80 Add more things │ │ 8b0ea80 Add more things │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
│ ↑ updated to d0018fcc21d87c91a1ff9155aed6b4e57535566b (02bef3f) [ ... ] │ │ ↑ updated to d0018fcc21d87c91a1ff9155aed6b4e57535566b (02bef3f) [ ... ] │
│ ↑ updated to 31ecf28817c44d90686b5c3c624c1f4a534b6478 (9304dbc) [ ... ] │ │ ↑ updated to 31ecf28817c44d90686b5c3c624c1f4a534b6478 (9304dbc) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯

View File

@ -43,21 +43,21 @@ $ rad patch
``` ```
``` ```
$ rad patch show 73b73f376e93e09e0419664766ac9e433bf7d389 -p $ rad patch show 73b73f376e93e09e0419664766ac9e433bf7d389 -p
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Define power requirements │ Title Define power requirements │
│ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
│ Branches flux-capacitor-power │ Branches flux-capacitor-power │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status open │ Status open │
│ │
│ See details. │ See details. │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 3e674d1 Define power requirements │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
commit 3e674d1a1df90807e934f9ae5da2591dd6848a33 commit 3e674d1a1df90807e934f9ae5da2591dd6848a33
Author: radicle <radicle@localhost> Author: radicle <radicle@localhost>
@ -126,7 +126,7 @@ $ rad patch show 73b73f3
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │ │ Title Define power requirements │
│ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │ │ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Branches flux-capacitor-power, patch/73b73f3 │ │ Branches flux-capacitor-power, patch/73b73f3 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
@ -137,9 +137,9 @@ $ rad patch show 73b73f3
│ 27857ec Add README, just for the fun │ │ 27857ec Add README, just for the fun │
│ 3e674d1 Define power requirements │ │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
│ ↑ updated to 5605784ae81dad91ba47ea55e19dd16f6280d44b (27857ec) [ ... ] │ │ ↑ updated to 5605784ae81dad91ba47ea55e19dd16f6280d44b (27857ec) [ ... ] │
│ ✓ accepted by (you) [ ... ] │ ✓ accepted by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
``` ```
@ -151,7 +151,7 @@ $ rad patch show 73b73f3
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │ │ Title Define power requirements │
│ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │ │ Patch 73b73f376e93e09e0419664766ac9e433bf7d389 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ Author z6MknSL…StBU8Vi (you)
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Branches flux-capacitor-power, patch/73b73f3 │ │ Branches flux-capacitor-power, patch/73b73f3 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
@ -162,8 +162,8 @@ $ rad patch show 73b73f3
│ 27857ec Add README, just for the fun │ │ 27857ec Add README, just for the fun │
│ 3e674d1 Define power requirements │ │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by (you) [ ... ] │ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
│ ↑ updated to 5605784ae81dad91ba47ea55e19dd16f6280d44b (27857ec) [ ... ] │ │ ↑ updated to 5605784ae81dad91ba47ea55e19dd16f6280d44b (27857ec) [ ... ] │
│ ✓ accepted by (you) [ ... ] │ ✓ accepted by z6MknSL…StBU8Vi (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
``` ```

View File

@ -8,6 +8,7 @@ $ rad issue open --title "flux capacitor underpowered" --description "Flux capac
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 2f6eb49efac492327f71437b6bfc01b49afa0981 │ │ Issue 2f6eb49efac492327f71437b6bfc01b49afa0981 │
│ Author bob (you) │
│ Status open │ │ Status open │
│ │ │ │
│ Flux capacitor power requirements exceed current supply │ │ Flux capacitor power requirements exceed current supply │
@ -18,11 +19,11 @@ The issue is now listed under our project.
``` ```
$ rad issue list $ rad issue list
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │ │ ● ID Title Author Labels Assignees Opened │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ● 2f6eb49 flux capacitor underpowered z6Mkt67…v4N1tRk bob (you) [ .. ] │ │ ● 2f6eb49 flux capacitor underpowered bob (you) [ .. ] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
``` ```
Great! Now we've documented the issue for ourselves and others. Great! Now we've documented the issue for ourselves and others.
@ -40,11 +41,11 @@ It will now show in the list of issues assigned to us.
``` ```
$ rad issue list --assigned $ rad issue list --assigned
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │ │ ● ID Title Author Labels Assignees Opened │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ● 2f6eb49 flux capacitor underpowered z6Mkt67…v4N1tRk bob (you) bob (z6Mkt67…v4N1tRk) [ .. ] │ │ ● 2f6eb49 flux capacitor underpowered bob (you) bob [ .. ] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
``` ```
In addition, you can see that when you run `rad issue show` you are listed under the `Assignees`. In addition, you can see that when you run `rad issue show` you are listed under the `Assignees`.
@ -54,6 +55,7 @@ $ rad issue show 2f6eb49
╭─────────────────────────────────────────────────────────╮ ╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │ │ Title flux capacitor underpowered │
│ Issue 2f6eb49efac492327f71437b6bfc01b49afa0981 │ │ Issue 2f6eb49efac492327f71437b6bfc01b49afa0981 │
│ Author bob (you) │
│ Assignees z6Mkt67…v4N1tRk │ │ Assignees z6Mkt67…v4N1tRk │
│ Status open │ │ Status open │
│ │ │ │

View File

@ -35,27 +35,27 @@ It will now be listed as one of the project's open patches.
``` ```
$ rad patch $ rad patch
╭────────────────────────────────────────────────────────────────────────────────────────────────── ╭─────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │ │ ● ID Title Author Head + - Updated │
├────────────────────────────────────────────────────────────────────────────────────────────────── ├─────────────────────────────────────────────────────────────────────────────────────┤
│ ● 69e881c Define power requirements z6Mkt67…v4N1tRk bob (you) 3e674d1 +0 -0 [ ... ] │ │ ● 69e881c Define power requirements bob (you) 3e674d1 +0 -0 [ ... ] │
╰────────────────────────────────────────────────────────────────────────────────────────────────── ╰─────────────────────────────────────────────────────────────────────────────────────╯
$ rad patch show 69e881c606639691330051d7d8f013854f32fb87 $ rad patch show 69e881c606639691330051d7d8f013854f32fb87
╭──────────────────────────────────────────────────────────────────── ╭────────────────────────────────────────────────────╮
│ Title Define power requirements │ Title Define power requirements │
│ Patch 69e881c606639691330051d7d8f013854f32fb87 │ Patch 69e881c606639691330051d7d8f013854f32fb87 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ Author bob (you)
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
│ Branches flux-capacitor-power │ Branches flux-capacitor-power │
│ Commits ahead 1, behind 0 │ Commits ahead 1, behind 0 │
│ Status open │ Status open │
│ │
│ See details. │ See details. │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ 3e674d1 Define power requirements │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────── ├────────────────────────────────────────────────────┤
│ ● opened by bob (you) [ ... ] │ ● opened by bob (you) [ ... ] │
╰──────────────────────────────────────────────────────────────────── ╰────────────────────────────────────────────────────╯
``` ```
We can also confirm that the patch branch is in storage: We can also confirm that the patch branch is in storage:

View File

@ -37,7 +37,7 @@ $ rad patch show 69e881c
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │ │ Title Define power requirements │
│ Patch 69e881c606639691330051d7d8f013854f32fb87 │ │ Patch 69e881c606639691330051d7d8f013854f32fb87 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ Author bob z6Mkt67…v4N1tRk
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Commits ahead 2, behind 0 │ │ Commits ahead 2, behind 0 │
│ Status open │ │ Status open │
@ -47,7 +47,7 @@ $ rad patch show 69e881c
│ 27857ec Add README, just for the fun │ │ 27857ec Add README, just for the fun │
│ 3e674d1 Define power requirements │ │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by bob (z6Mkt67…v4N1tRk) [ ... ] │ │ ● opened by bob z6Mkt67…v4N1tRk [ ... ]
│ ↑ updated to dcf3e6dd97c95cf8653cbb8ce47df20d28eb1821 (27857ec) [ ... ] │ │ ↑ updated to dcf3e6dd97c95cf8653cbb8ce47df20d28eb1821 (27857ec) [ ... ] │
╰──────────────────────────────────────────────────────────────────────────────╯ ╰──────────────────────────────────────────────────────────────────────────────╯
``` ```
@ -97,7 +97,7 @@ $ rad patch show 69e881c
╭──────────────────────────────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │ │ Title Define power requirements │
│ Patch 69e881c606639691330051d7d8f013854f32fb87 │ │ Patch 69e881c606639691330051d7d8f013854f32fb87 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ Author bob z6Mkt67…v4N1tRk
│ Head f567f695d25b4e8fb63b5f5ad2a584529826e908 │ │ Head f567f695d25b4e8fb63b5f5ad2a584529826e908 │
│ Branches master, patch/69e881c │ │ Branches master, patch/69e881c │
│ Commits up to date │ │ Commits up to date │
@ -109,7 +109,7 @@ $ rad patch show 69e881c
│ 27857ec Add README, just for the fun │ │ 27857ec Add README, just for the fun │
│ 3e674d1 Define power requirements │ │ 3e674d1 Define power requirements │
├──────────────────────────────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────────────────────────────┤
│ ● opened by bob (z6Mkt67…v4N1tRk) [ ... ] │ │ ● opened by bob z6Mkt67…v4N1tRk [ ... ]
│ ↑ updated to dcf3e6dd97c95cf8653cbb8ce47df20d28eb1821 (27857ec) [ ... ] │ │ ↑ updated to dcf3e6dd97c95cf8653cbb8ce47df20d28eb1821 (27857ec) [ ... ] │
│ ↑ updated to ab05fcdca93cf4d5b22da8913e2fe0b6d8c79338 (f567f69) [ ... ] │ │ ↑ updated to ab05fcdca93cf4d5b22da8913e2fe0b6d8c79338 (f567f69) [ ... ] │
│ ✓ merged by alice (you) [ ... ] │ │ ✓ merged by alice (you) [ ... ] │

View File

@ -10,14 +10,15 @@ use radicle::cob::issue;
use radicle::cob::issue::{CloseReason, Issues, State}; use radicle::cob::issue::{CloseReason, Issues, State};
use radicle::cob::thread; use radicle::cob::thread;
use radicle::crypto::Signer; use radicle::crypto::Signer;
use radicle::node::{AliasStore, Handle}; use radicle::node::Handle;
use radicle::prelude::Did; use radicle::prelude::Did;
use radicle::profile; use radicle::profile;
use radicle::storage; use radicle::storage;
use radicle::storage::{WriteRepository, WriteStorage}; use radicle::storage::{WriteRepository, WriteStorage};
use radicle::Profile;
use radicle::{cob, Node}; use radicle::{cob, Node};
use radicle_term::table::TableOptions; use radicle_term::table::TableOptions;
use radicle_term::{Paint, Table, VStack}; use radicle_term::{Table, VStack};
use crate::git::Rev; use crate::git::Rev;
use crate::terminal as term; use crate::terminal as term;
@ -288,7 +289,15 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
title, title,
description, description,
} => { } => {
edit(&mut issues, &signer, &repo, id, title, description)?; edit(
&mut issues,
&signer,
&repo,
id,
title,
description,
&profile,
)?;
} }
Operation::Open { Operation::Open {
title: Some(title), title: Some(title),
@ -297,7 +306,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
} => { } => {
let issue = issues.create(title, description, labels.as_slice(), &[], [], &signer)?; let issue = issues.create(title, description, labels.as_slice(), &[], [], &signer)?;
if !options.quiet { if !options.quiet {
show_issue(&issue, issue.id())?; show_issue(&issue, issue.id(), &profile)?;
} }
} }
Operation::Show { id } => { Operation::Show { id } => {
@ -305,7 +314,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let issue = issues let issue = issues
.get(&id)? .get(&id)?
.context("No issue with the given ID exists")?; .context("No issue with the given ID exists")?;
show_issue(&issue, &id)?; show_issue(&issue, &id, &profile)?;
} }
Operation::State { id, state } => { Operation::State { id, state } => {
let id = id.resolve(&repo.backend)?; let id = id.resolve(&repo.backend)?;
@ -338,6 +347,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
&options, &options,
&mut issues, &mut issues,
&signer, &signer,
&profile,
)?; )?;
} }
Operation::List { assigned, state } => { Operation::List { assigned, state } => {
@ -412,24 +422,20 @@ fn list<R: WriteRepository + cob::Store>(
term::format::bold(String::from("ID")).into(), term::format::bold(String::from("ID")).into(),
term::format::bold(String::from("Title")).into(), term::format::bold(String::from("Title")).into(),
term::format::bold(String::from("Author")).into(), term::format::bold(String::from("Author")).into(),
term::format::bold(String::new()).into(), term::Line::blank(),
term::format::bold(String::from("Labels")).into(), term::format::bold(String::from("Labels")).into(),
term::format::bold(String::from("Assignees")).into(), term::format::bold(String::from("Assignees")).into(),
term::format::bold(String::from("Opened")).into(), term::format::bold(String::from("Opened")).into(),
]); ]);
table.divider(); table.divider();
let aliases = profile.aliases();
for (id, issue) in all { for (id, issue) in all {
let assigned: String = issue let assigned: String = issue
.assigned() .assigned()
.map(|p| { .map(|did| {
if let Some(alias) = aliases.alias(p) { let (alias, _) = Author::new(did.as_key(), profile).labels();
format!("{alias} ({})", term::format::did(p))
} else { alias.content().to_owned()
term::format::did(p).to_string()
}
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(", "); .join(", ");
@ -438,8 +444,7 @@ fn list<R: WriteRepository + cob::Store>(
labels.sort(); labels.sort();
let author = issue.author().id; let author = issue.author().id;
let alias = aliases.alias(&author); let (alias, did) = Author::new(&author, profile).labels();
let display = Author::new(&author, alias, profile);
table.push([ table.push([
match issue.state() { match issue.state() {
@ -450,13 +455,13 @@ fn list<R: WriteRepository + cob::Store>(
.to_owned() .to_owned()
.into(), .into(),
term::format::default(issue.title().to_owned()).into(), term::format::default(issue.title().to_owned()).into(),
term::format::did(&issue.author().id).dim().into(), alias.into(),
display.alias(), did.into(),
term::format::secondary(labels.join(", ")).into(), term::format::secondary(labels.join(", ")).into(),
if assigned.is_empty() { if assigned.is_empty() {
term::format::dim(String::default()).into() term::format::dim(String::default()).into()
} else { } else {
term::format::default(assigned.to_string()).into() term::format::primary(assigned.to_string()).dim().into()
}, },
term::format::timestamp(&issue.timestamp()) term::format::timestamp(&issue.timestamp())
.dim() .dim()
@ -554,6 +559,7 @@ fn open<R: WriteRepository + cob::Store, G: Signer>(
options: &Options, options: &Options,
issues: &mut Issues<R>, issues: &mut Issues<R>,
signer: &G, signer: &G,
profile: &Profile,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let Some((meta, description)) = prompt_issue( let Some((meta, description)) = prompt_issue(
&title.unwrap_or_default(), &title.unwrap_or_default(),
@ -573,7 +579,7 @@ fn open<R: WriteRepository + cob::Store, G: Signer>(
signer, signer,
)?; )?;
if !options.quiet { if !options.quiet {
show_issue(&issue, issue.id())?; show_issue(&issue, issue.id(), profile)?;
} }
Ok(()) Ok(())
@ -586,6 +592,7 @@ fn edit<R: WriteRepository + cob::Store, G: radicle::crypto::Signer>(
id: Rev, id: Rev,
title: Option<String>, title: Option<String>,
description: Option<String>, description: Option<String>,
profile: &Profile,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let id = id.resolve(&repo.backend)?; let id = id.resolve(&repo.backend)?;
let mut issue = issues.get_mut(&id)?; let mut issue = issues.get_mut(&id)?;
@ -629,56 +636,65 @@ fn edit<R: WriteRepository + cob::Store, G: radicle::crypto::Signer>(
Ok(()) Ok(())
})?; })?;
show_issue(&issue, &id)?; show_issue(&issue, &id, profile)?;
Ok(()) Ok(())
} }
fn show_issue(issue: &issue::Issue, id: &cob::ObjectId) -> anyhow::Result<()> { fn show_issue(issue: &issue::Issue, id: &cob::ObjectId, profile: &Profile) -> anyhow::Result<()> {
let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect(); let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect();
let assignees: Vec<String> = issue let assignees: Vec<String> = issue
.assigned() .assigned()
.map(|a| term::format::did(a).to_string()) .map(|a| term::format::did(a).to_string())
.collect(); .collect();
let author = issue.author();
let did = author.id();
let author = Author::new(did, profile);
let mut attrs = Table::<2, Paint<String>>::new(TableOptions { let mut attrs = Table::<2, term::Line>::new(TableOptions {
spacing: 2, spacing: 2,
..TableOptions::default() ..TableOptions::default()
}); });
attrs.push([ attrs.push([
term::format::tertiary("Title".to_owned()), term::format::tertiary("Title".to_owned()).into(),
term::format::bold(issue.title().to_owned()), term::format::bold(issue.title().to_owned()).into(),
]); ]);
attrs.push([ attrs.push([
term::format::tertiary("Issue".to_owned()), term::format::tertiary("Issue".to_owned()).into(),
term::format::bold(id.to_string()), term::format::bold(id.to_string()).into(),
]);
attrs.push([
term::format::tertiary("Author".to_owned()).into(),
author.line(),
]); ]);
if !labels.is_empty() { if !labels.is_empty() {
attrs.push([ attrs.push([
term::format::tertiary("Labels".to_owned()), term::format::tertiary("Labels".to_owned()).into(),
term::format::secondary(labels.join(", ")), term::format::secondary(labels.join(", ")).into(),
]); ]);
} }
if !assignees.is_empty() { if !assignees.is_empty() {
attrs.push([ attrs.push([
term::format::tertiary("Assignees".to_owned()), term::format::tertiary("Assignees".to_owned()).into(),
term::format::dim(assignees.join(", ")), term::format::dim(assignees.join(", ")).into(),
]); ]);
} }
attrs.push([ attrs.push([
term::format::tertiary("Status".to_owned()), term::format::tertiary("Status".to_owned()).into(),
match issue.state() { match issue.state() {
issue::State::Open => term::format::positive("open".to_owned()), issue::State::Open => term::format::positive("open".to_owned()).into(),
issue::State::Closed { reason } => term::format::default(format!( issue::State::Closed { reason } => term::format::default(format!(
"{} {}", "{} {}",
term::format::negative("closed"), term::format::negative("closed"),
term::format::default(format!("as {reason}")) term::format::default(format!("as {reason}"))
)), ))
.into(),
}, },
]); ]);

View File

@ -36,7 +36,7 @@ fn print_table(entries: impl IntoIterator<Item = (Id, NodeId)>) {
for (rid, nid) in entries { for (rid, nid) in entries {
t.push([ t.push([
term::format::highlight(rid.to_string()), term::format::highlight(rid.to_string()),
term::format::default(term::format::node(&nid)), term::format::node(&nid),
]); ]);
} }
t.print(); t.print();

View File

@ -1,6 +1,5 @@
use radicle::cob::patch; use radicle::cob::patch;
use radicle::cob::patch::{Patch, PatchId, Patches, Verdict}; use radicle::cob::patch::{Patch, PatchId, Patches, Verdict};
use radicle::node::AliasStore;
use radicle::prelude::*; use radicle::prelude::*;
use radicle::profile::Profile; use radicle::profile::Profile;
use radicle::storage::git::Repository; use radicle::storage::git::Repository;
@ -48,7 +47,7 @@ pub fn run(
term::format::bold(String::from("ID")).into(), term::format::bold(String::from("ID")).into(),
term::format::bold(String::from("Title")).into(), term::format::bold(String::from("Title")).into(),
term::format::bold(String::from("Author")).into(), term::format::bold(String::from("Author")).into(),
term::format::bold(String::new()).into(), term::Line::blank(),
term::format::bold(String::from("Head")).into(), term::format::bold(String::from("Head")).into(),
term::format::bold(String::from("+")).into(), term::format::bold(String::from("+")).into(),
term::format::bold(String::from("-")).into(), term::format::bold(String::from("-")).into(),
@ -65,13 +64,9 @@ pub fn run(
is_me.then(by_rev_time).then(by_id) is_me.then(by_rev_time).then(by_id)
}); });
let aliases = profile.aliases();
let mut errors = Vec::new(); let mut errors = Vec::new();
for (id, patch) in &mut all { for (id, patch) in &mut all {
let author_id = patch.author().id(); match row(id, patch, repository, profile) {
let alias = aliases.alias(author_id);
match row(profile, alias, id, patch, repository) {
Ok(r) => table.push(r), Ok(r) => table.push(r),
Err(e) => errors.push((patch.title(), id, e.to_string())), Err(e) => errors.push((patch.title(), id, e.to_string())),
} }
@ -92,18 +87,17 @@ pub fn run(
/// Patch row. /// Patch row.
pub fn row( pub fn row(
profile: &Profile,
alias: Option<Alias>,
id: &PatchId, id: &PatchId,
patch: &Patch, patch: &Patch,
repository: &Repository, repository: &Repository,
profile: &Profile,
) -> anyhow::Result<[term::Line; 9]> { ) -> anyhow::Result<[term::Line; 9]> {
let state = patch.state(); let state = patch.state();
let (_, revision) = patch.latest(); let (_, revision) = patch.latest();
let (from, to) = patch.range(repository)?; let (from, to) = patch.range(repository)?;
let stats = common::diff_stats(repository.raw(), &from, &to)?; let stats = common::diff_stats(repository.raw(), &from, &to)?;
let author = patch.author().id; let author = patch.author().id;
let display = Author::new(&author, alias, profile); let (alias, did) = Author::new(&author, profile).labels();
Ok([ Ok([
match state { match state {
@ -114,8 +108,8 @@ pub fn row(
}, },
term::format::tertiary(term::format::cob(id)).into(), term::format::tertiary(term::format::cob(id)).into(),
term::format::default(patch.title().to_owned()).into(), term::format::default(patch.title().to_owned()).into(),
term::format::did(&author).dim().into(), alias.into(),
display.alias(), did.into(),
term::format::secondary(term::format::oid(revision.head())).into(), term::format::secondary(term::format::oid(revision.head())).into(),
term::format::positive(format!("+{}", stats.insertions())).into(), term::format::positive(format!("+{}", stats.insertions())).into(),
term::format::negative(format!("-{}", stats.deletions())).into(), term::format::negative(format!("-{}", stats.deletions())).into(),
@ -132,14 +126,12 @@ pub fn timeline(
patch: &Patch, patch: &Patch,
repository: &Repository, repository: &Repository,
) -> anyhow::Result<Vec<term::Line>> { ) -> anyhow::Result<Vec<term::Line>> {
let aliases = profile.aliases();
let alias = aliases.alias(patch.author().id());
let open = term::Line::spaced([ let open = term::Line::spaced([
term::format::positive("").into(), term::format::positive("").into(),
term::format::default("opened by").into(), term::format::default("opened by").into(),
]) ])
.space() .space()
.extend(Author::new(patch.author().id(), alias, profile)); .extend(Author::new(patch.author().id(), profile).line());
let mut timeline = vec![(patch.timestamp(), open)]; let mut timeline = vec![(patch.timestamp(), open)];
@ -165,14 +157,13 @@ pub fn timeline(
for (nid, merge) in patch.merges().filter(|(_, m)| m.revision == *revision_id) { for (nid, merge) in patch.merges().filter(|(_, m)| m.revision == *revision_id) {
let peer = repository.remote(nid)?; let peer = repository.remote(nid)?;
let alias = aliases.alias(&peer.id);
let line = term::Line::spaced([ let line = term::Line::spaced([
term::format::primary("").bold().into(), term::format::primary("").bold().into(),
term::format::default("merged").into(), term::format::default("merged").into(),
term::format::default("by").into(), term::format::default("by").into(),
]) ])
.space() .space()
.extend(Author::new(&peer.id, alias, profile)); .extend(Author::new(&peer.id, profile).line());
timeline.push((merge.timestamp, line)); timeline.push((merge.timestamp, line));
} }
@ -189,14 +180,13 @@ pub fn timeline(
None => term::format::default("reviewed"), None => term::format::default("reviewed"),
}; };
let peer = repository.remote(reviewer)?; let peer = repository.remote(reviewer)?;
let alias = aliases.alias(&peer.id);
let line = term::Line::spaced([ let line = term::Line::spaced([
verdict_symbol.into(), verdict_symbol.into(),
verdict_verb.into(), verdict_verb.into(),
term::format::default("by").into(), term::format::default("by").into(),
]) ])
.space() .space()
.extend(Author::new(&peer.id, alias, profile)); .extend(Author::new(&peer.id, profile).line());
timeline.push((review.timestamp(), line)); timeline.push((review.timestamp(), line));
} }

View File

@ -74,6 +74,8 @@ pub fn run(
*revision.head(), *revision.head(),
*patch.target().head(stored)?, *patch.target().head(stored)?,
)?; )?;
let author = patch.author();
let author = term::format::Author::new(author.id(), profile);
let mut attrs = Table::<2, term::Line>::new(TableOptions { let mut attrs = Table::<2, term::Line>::new(TableOptions {
spacing: 2, spacing: 2,
@ -89,7 +91,7 @@ pub fn run(
]); ]);
attrs.push([ attrs.push([
term::format::tertiary("Author".to_owned()).into(), term::format::tertiary("Author".to_owned()).into(),
term::format::default(patch.author().id().to_string()).into(), author.line(),
]); ]);
attrs.push([ attrs.push([
term::format::tertiary("Head".to_owned()).into(), term::format::tertiary("Head".to_owned()).into(),

View File

@ -12,12 +12,12 @@ use radicle_term::element::Line;
use crate::terminal as term; use crate::terminal as term;
/// Format a node id to be more compact. /// Format a node id to be more compact.
pub fn node(node: &NodeId) -> String { pub fn node(node: &NodeId) -> Paint<String> {
let node = node.to_human(); let node = node.to_human();
let start = node.chars().take(7).collect::<String>(); let start = node.chars().take(7).collect::<String>();
let end = node.chars().skip(node.len() - 7).collect::<String>(); let end = node.chars().skip(node.len() - 7).collect::<String>();
format!("{start}{end}") Paint::new(format!("{start}{end}"))
} }
/// Format a git Oid. /// Format a git Oid.
@ -120,7 +120,7 @@ impl<'a> fmt::Display for Identity<'a> {
let nid = self.profile.id(); let nid = self.profile.id();
let alias = self.profile.aliases().alias(nid); let alias = self.profile.aliases().alias(nid);
let node_id = match self.short { let node_id = match self.short {
true => self::node(nid), true => self::node(nid).to_string(),
false => nid.to_human(), false => nid.to_human(),
}; };
@ -140,88 +140,45 @@ impl<'a> fmt::Display for Identity<'a> {
} }
/// This enum renders (nid, alias) in terminal depending on user variant. /// This enum renders (nid, alias) in terminal depending on user variant.
pub enum Author<'a> { pub struct Author<'a> {
Author { nid: &'a NodeId,
nid: &'a NodeId, alias: Option<Alias>,
alias: Option<Alias>, you: bool,
},
Me {
alias: Option<Alias>,
},
} }
impl<'a> Author<'a> { impl<'a> Author<'a> {
pub fn new(nid: &'a NodeId, alias: Option<Alias>, me: &Profile) -> Author<'a> { pub fn new(nid: &'a NodeId, profile: &Profile) -> Author<'a> {
if nid == me.id() { let alias = profile.aliases().alias(nid);
Self::Me { alias }
Self {
nid,
alias,
you: nid == profile.id(),
}
}
pub fn labels(self) -> (term::Label, term::Label) {
let alias = match &self.alias {
Some(alias) => term::format::primary(alias).into(),
None => term::format::primary(term::format::node(self.nid))
.dim()
.into(),
};
if self.you {
(alias, term::format::primary("(you)").dim().italic().into())
} else { } else {
Self::Author { nid, alias } (
alias,
term::format::primary(term::format::node(self.nid))
.dim()
.into(),
)
} }
} }
/// Author: `<alias>` || `` pub fn line(self) -> Line {
/// Me : `<alias> (you)` || `(you)` let (first, second) = self.labels();
pub fn alias(&self) -> Line { Line::spaced([first, second])
match self {
Self::Me { alias } => {
if let Some(alias) = alias {
term::Line::spaced([
term::format::primary(alias).into(),
term::format::primary("(you)").dim().into(),
])
} else {
term::format::primary("(you)").into()
}
}
Self::Author { alias, .. } => {
if let Some(alias) = alias {
term::format::primary(alias).into()
} else {
term::format::default(String::new()).into()
}
}
}
}
}
impl<'a> IntoIterator for Author<'a> {
type Item = term::Label;
type IntoIter = std::vec::IntoIter<Self::Item>;
/// Author : `<alias> (<compact-nid>)` || `<nid>`
/// Me : `<alias> (you)` || `(you)`
fn into_iter(self) -> Self::IntoIter {
let mut line = Vec::new();
match self {
Self::Me { alias } => {
if let Some(alias) = alias {
line.push(term::format::primary(alias).into());
line.push(term::Label::space());
line.push(term::format::primary("(you)").dim().into());
} else {
line.push(term::format::primary("(you)").into());
}
}
Self::Author { nid, alias } => {
if let Some(alias) = alias {
line.push(term::format::primary(alias).into());
line.push(term::Label::space());
line.push(
term::format::tertiary(term::format::parens(
term::format::node(nid).into(),
))
.into(),
);
} else {
line.push(term::format::tertiary(nid).into());
}
}
}
line.into_iter()
} }
} }

View File

@ -92,6 +92,11 @@ impl Line {
} }
} }
/// Create a blank line.
pub fn blank() -> Self {
Self { items: vec![] }
}
pub fn spaced(items: impl IntoIterator<Item = Label>) -> Self { pub fn spaced(items: impl IntoIterator<Item = Label>) -> Self {
let mut line = Self::default(); let mut line = Self::default();
for item in items.into_iter() { for item in items.into_iter() {

View File

@ -17,6 +17,11 @@ impl Label {
Self(Paint::default()) Self(Paint::default())
} }
/// Get unstyled content.
pub fn content(&self) -> &str {
self.0.content()
}
/// Create a single space label /// Create a single space label
pub fn space() -> Self { pub fn space() -> Self {
Self(Paint::new(" ".to_owned())) Self(Paint::new(" ".to_owned()))