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