emptyResult prints the conventional "(no X)" line and returns 0. Honors the requested format: JSON emits "[]", TSV emits a header-only stream, table emits the human-friendly placeholder.
(format listfmt.Format, label string, tsvHeaders []string)
| 114 | // the requested format: JSON emits "[]", TSV emits a header-only stream, |
| 115 | // table emits the human-friendly placeholder. |
| 116 | func emptyResult(format listfmt.Format, label string, tsvHeaders []string) int { |
| 117 | switch format { |
| 118 | case listfmt.FormatJSON: |
| 119 | return runJSON(os.Stdout, []any{}) |
| 120 | case listfmt.FormatTSV: |
| 121 | _ = listfmt.RenderTSV(os.Stdout, tsvHeaders, nil) |
| 122 | default: |
| 123 | fmt.Printf("(no %s)\n", label) |
| 124 | } |
| 125 | return 0 |
| 126 | } |
| 127 | |
| 128 | func listTagsCmd(args []string) int { |
| 129 | fs := flagSet("list tags") |
no test coverage detected