(io *iostreams.IOStreams, params map[string]any, state *shared.IssueMetadataState)
| 1189 | } |
| 1190 | |
| 1191 | func renderPullRequestTTY(io *iostreams.IOStreams, params map[string]any, state *shared.IssueMetadataState) error { |
| 1192 | cs := io.ColorScheme() |
| 1193 | out := io.Out |
| 1194 | |
| 1195 | fmt.Fprint(out, "Would have created a Pull Request with:\n") |
| 1196 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Title"), params["title"].(string)) |
| 1197 | fmt.Fprintf(out, "%s: %t\n", cs.Bold("Draft"), params["draft"]) |
| 1198 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Base"), params["baseRefName"]) |
| 1199 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Head"), params["headRefName"]) |
| 1200 | if len(state.Labels) != 0 { |
| 1201 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Labels"), strings.Join(state.Labels, ", ")) |
| 1202 | } |
| 1203 | if len(state.Reviewers) != 0 { |
| 1204 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Reviewers"), strings.Join(state.Reviewers, ", ")) |
| 1205 | } |
| 1206 | if len(state.Assignees) != 0 { |
| 1207 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Assignees"), strings.Join(state.Assignees, ", ")) |
| 1208 | } |
| 1209 | if len(state.Milestones) != 0 { |
| 1210 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Milestones"), strings.Join(state.Milestones, ", ")) |
| 1211 | } |
| 1212 | if len(state.ProjectTitles) != 0 { |
| 1213 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Projects"), strings.Join(state.ProjectTitles, ", ")) |
| 1214 | } |
| 1215 | fmt.Fprintf(out, "%s: %t\n", cs.Bold("MaintainerCanModify"), params["maintainerCanModify"]) |
| 1216 | |
| 1217 | fmt.Fprintf(out, "%s\n", cs.Bold("Body:")) |
| 1218 | // Body |
| 1219 | var md string |
| 1220 | var err error |
| 1221 | if len(params["body"].(string)) == 0 { |
| 1222 | md = fmt.Sprintf("%s\n", cs.Muted("No description provided")) |
| 1223 | } else { |
| 1224 | md, err = markdown.Render(params["body"].(string), |
| 1225 | markdown.WithTheme(io.TerminalTheme()), |
| 1226 | markdown.WithWrap(io.TerminalWidth())) |
| 1227 | if err != nil { |
| 1228 | return err |
| 1229 | } |
| 1230 | } |
| 1231 | fmt.Fprintf(out, "%s", md) |
| 1232 | |
| 1233 | return nil |
| 1234 | } |
| 1235 | |
| 1236 | func previewPR(opts CreateOptions, openURL string) error { |
| 1237 | if opts.IO.IsStdinTTY() && opts.IO.IsStdoutTTY() { |
no test coverage detected