| 456 | } |
| 457 | |
| 458 | func printRawView(out io.Writer, d *client.Discussion) error { |
| 459 | fmt.Fprintf(out, "title:\t%s\n", d.Title) |
| 460 | state := "OPEN" |
| 461 | if d.Closed { |
| 462 | state = "CLOSED" |
| 463 | } |
| 464 | fmt.Fprintf(out, "state:\t%s\n", state) |
| 465 | fmt.Fprintf(out, "category:\t%s\n", d.Category.Name) |
| 466 | fmt.Fprintf(out, "author:\t%s\n", d.Author.Login) |
| 467 | fmt.Fprintf(out, "labels:\t%s\n", labelList(d.Labels, nil)) |
| 468 | fmt.Fprintf(out, "comments:\t%d\n", d.Comments.TotalCount) |
| 469 | fmt.Fprintf(out, "number:\t%d\n", d.Number) |
| 470 | fmt.Fprintf(out, "url:\t%s\n", d.URL) |
| 471 | fmt.Fprintln(out, "--") |
| 472 | fmt.Fprintln(out, d.Body) |
| 473 | |
| 474 | return nil |
| 475 | } |
| 476 | |
| 477 | // printRawComments writes the comments as a sequence of metadata blocks, |
| 478 | // without any discussion-level fields or nested replies. Comments are |