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