Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: show the issue when it is created
Vincenzo Palazzo committed 3 years ago
commit f8aa1daedb391069847c66e14b2da6cc2e5669ae
parent 9f1896e07f8e5c966113f47bcd081c85e5ba9718
2 files changed +17 -9
modified radicle-cli/examples/rad-issue.md
@@ -5,6 +5,12 @@ 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
+
state: open
+
tags: []
+
assignees: []
+

+
Flux capacitor power requirements exceed current supply
```

The issue is now listed under our project.
modified radicle-cli/src/commands/issue.rs
@@ -220,7 +220,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            title: Some(title),
            description: Some(description),
        } => {
-
            issues.create(title, description, &[], &[], &signer)?;
+
            let issue = issues.create(title, description, &[], &[], &signer)?;
+
            show_issue(&issue)?;
        }
        Operation::Show { id } => {
            let issue = issues
@@ -275,7 +276,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                let meta: Metadata =
                    serde_yaml::from_str(&meta).context("failed to parse yaml front-matter")?;

-
                issues.create(
+
                let issue = issues.create(
                    &meta.title,
                    description.trim(),
                    meta.labels.as_slice(),
@@ -286,6 +287,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                        .as_slice(),
                    &signer,
                )?;
+
                show_issue(&issue)?;
            }
        }
        Operation::List { assigned } => {
@@ -336,15 +338,15 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
}

fn show_issue(issue: &issue::Issue) -> anyhow::Result<()> {
-
    term::info!("title: {}", issue.title());
-
    term::info!("state: {}", issue.state());
-

    let tags: Vec<String> = issue.tags().cloned().map(|t| t.into()).collect();
-
    term::info!("tags: {}", tags.join(", "));
-

    let assignees: Vec<String> = issue.assigned().map(|a| a.to_string()).collect();
-
    term::info!("assignees: {}", assignees.join(", "));

-
    term::info!("{}", issue.description().unwrap_or(""));
+
    term::info!("title: {}", issue.title());
+
    term::info!("state: {}", issue.state());
+
    term::info!("tags: [{}]", tags.join(", "));
+
    term::info!("assignees: [{}]", assignees.join(", "));
+
    term::blank();
+
    term::info!("{}", issue.description().unwrap_or_default());
+

    Ok(())
}