Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Add issue id to `show_issue` function
Sebastian Martinez committed 2 years ago
commit 6578fedfbbdbe783e81ebf00858b6ceeb920cb17
parent d2202a07abea26078e8c4157a85c94e967449a4e
4 files changed +16 -5
modified radicle-cli/examples/rad-issue.md
@@ -7,6 +7,7 @@ Let's say the new car you are designing with your peers has a problem with its f
$ rad issue open --title "flux capacitor underpowered" --description "Flux capacitor power requirements exceed current supply" --no-announce
╭─────────────────────────────────────────────────────────╮
│ Title   flux capacitor underpowered                     │
+
│ Issue   2e8c1bf3fe0532a314778357c886608a966a34bd        │
│ Status  open                                            │
│                                                         │
│ Flux capacitor power requirements exceed current supply │
@@ -30,6 +31,7 @@ Show the issue information issue.
$ rad issue show 2e8c1bf
╭─────────────────────────────────────────────────────────╮
│ Title   flux capacitor underpowered                     │
+
│ Issue   2e8c1bf3fe0532a314778357c886608a966a34bd        │
│ Status  open                                            │
│                                                         │
│ Flux capacitor power requirements exceed current supply │
modified radicle-cli/examples/rad-tag.md
@@ -11,6 +11,7 @@ We can now show the issue to check whether those tags were added:
$ rad issue show 2e8c1bf3fe0532a314778357c886608a966a34bd
╭─────────────────────────────────────────────────────────╮
│ Title   flux capacitor underpowered                     │
+
│ Issue   2e8c1bf3fe0532a314778357c886608a966a34bd        │
│ Tags    bug, good-first-issue                           │
│ Status  open                                            │
│                                                         │
@@ -30,6 +31,7 @@ Notice that the `good-first-issue` tag has disappeared:
$ rad issue show 2e8c1bf3fe0532a314778357c886608a966a34bd
╭─────────────────────────────────────────────────────────╮
│ Title   flux capacitor underpowered                     │
+
│ Issue   2e8c1bf3fe0532a314778357c886608a966a34bd        │
│ Tags    bug                                             │
│ Status  open                                            │
│                                                         │
modified radicle-cli/examples/workflow/3-issues.md
@@ -7,6 +7,7 @@ Let's say the new car you are designing with your peers has a problem with its f
$ rad issue open --title "flux capacitor underpowered" --description "Flux capacitor power requirements exceed current supply" --no-announce
╭─────────────────────────────────────────────────────────╮
│ Title   flux capacitor underpowered                     │
+
│ Issue   b05e945bb63c11bf80320f4e26ad1d1f7c51f755        │
│ Status  open                                            │
│                                                         │
│ Flux capacitor power requirements exceed current supply │
@@ -52,6 +53,7 @@ In addition, you can see that when you run `rad issue show` you are listed under
$ rad issue show b05e945
╭─────────────────────────────────────────────────────────╮
│ Title      flux capacitor underpowered                  │
+
│ Issue      b05e945bb63c11bf80320f4e26ad1d1f7c51f755     │
│ Assignees  z6Mkt67…v4N1tRk                              │
│ Status     open                                         │
│                                                         │
modified radicle-cli/src/commands/issue.rs
@@ -284,7 +284,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
        } => {
            let issue = issues.create(title, description, tags.as_slice(), &[], &signer)?;
            if !options.quiet {
-
                show_issue(&issue)?;
+
                show_issue(&issue, issue.id())?;
            }
        }
        Operation::Show { id } => {
@@ -292,7 +292,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            let issue = issues
                .get(&id)?
                .context("No issue with the given ID exists")?;
-
            show_issue(&issue)?;
+
            show_issue(&issue, &id)?;
        }
        Operation::State { id, state } => {
            let id = id.resolve(&repo.backend)?;
@@ -536,7 +536,7 @@ fn open<G: Signer>(
        signer,
    )?;
    if !options.quiet {
-
        show_issue(&issue)?;
+
        show_issue(&issue, issue.id())?;
    }

    Ok(())
@@ -618,12 +618,12 @@ fn edit<G: radicle::crypto::Signer>(
        Ok(())
    })?;

-
    show_issue(&issue)?;
+
    show_issue(&issue, &id)?;

    Ok(())
}

-
fn show_issue(issue: &issue::Issue) -> anyhow::Result<()> {
+
fn show_issue(issue: &issue::Issue, id: &cob::ObjectId) -> anyhow::Result<()> {
    let tags: Vec<String> = issue.tags().cloned().map(|t| t.into()).collect();
    let assignees: Vec<String> = issue
        .assigned()
@@ -640,6 +640,11 @@ fn show_issue(issue: &issue::Issue) -> anyhow::Result<()> {
        term::format::bold(issue.title().to_owned()),
    ]);

+
    attrs.push([
+
        term::format::tertiary("Issue".to_owned()),
+
        term::format::bold(id.to_string()),
+
    ]);
+

    if !tags.is_empty() {
        attrs.push([
            term::format::tertiary("Tags".to_owned()),