Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Use term::Table to print list of issues
Slack Coder committed 3 years ago
commit 6b67e0571ebb0c69100ac4b9218e893668b7b925
parent 946d6ac6755a78a0b1e7bb41b3efdb824c9e9945
2 files changed +10 -6
modified radicle-cli/src/commands/issue.rs
@@ -233,6 +233,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            }
        }
        Operation::List => {
+
            let mut t = term::Table::new(term::table::TableOptions::default());
            for result in issues.all()? {
                let (id, issue, _) = result?;

@@ -241,12 +242,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                    .map(|p| p.to_string())
                    .collect::<Vec<_>>()
                    .join(", ");
-
                if assigned.is_empty() {
-
                    println!("{} \"{}\"", id, issue.title().escape_default());
-
                } else {
-
                    println!("{} {:?} {}", id, issue.title().escape_default(), &assigned,);
-
                }
+
                t.push([
+
                    id.to_string(),
+
                    format!("{:?}", issue.title()),
+
                    assigned.to_string(),
+
                ]);
            }
+
            t.render();
        }
        Operation::Delete { id } => {
            issues.remove(&id)?;
modified radicle-cli/src/terminal/table.rs
@@ -59,10 +59,12 @@ impl<const W: usize> Table<W> {
                    .ok();
                }
            }
+

+
            let output = output.trim_end();
            println!(
                "{}",
                if let Some(width) = width {
-
                    console::truncate_str(&output, width - 1, "…")
+
                    console::truncate_str(output, width - 1, "…")
                } else {
                    output.into()
                }