(io *iostreams.IOStreams, params map[string]interface{}, state *shared.IssueMetadataState)
| 1107 | } |
| 1108 | |
| 1109 | func renderPullRequestTTY(io *iostreams.IOStreams, params map[string]interface{}, state *shared.IssueMetadataState) error { |
| 1110 | cs := io.ColorScheme() |
| 1111 | out := io.Out |
| 1112 | |
| 1113 | fmt.Fprint(out, "Would have created a Pull Request with:\n") |
| 1114 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Title"), params["title"].(string)) |
| 1115 | fmt.Fprintf(out, "%s: %t\n", cs.Bold("Draft"), params["draft"]) |
| 1116 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Base"), params["baseRefName"]) |
| 1117 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Head"), params["headRefName"]) |
| 1118 | if len(state.Labels) != 0 { |
| 1119 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Labels"), strings.Join(state.Labels, ", ")) |
| 1120 | } |
| 1121 | if len(state.Reviewers) != 0 { |
| 1122 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Reviewers"), strings.Join(state.Reviewers, ", ")) |
| 1123 | } |
| 1124 | if len(state.Assignees) != 0 { |
| 1125 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Assignees"), strings.Join(state.Assignees, ", ")) |
| 1126 | } |
| 1127 | if len(state.Milestones) != 0 { |
| 1128 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Milestones"), strings.Join(state.Milestones, ", ")) |
| 1129 | } |
| 1130 | if len(state.ProjectTitles) != 0 { |
| 1131 | fmt.Fprintf(out, "%s: %s\n", cs.Bold("Projects"), strings.Join(state.ProjectTitles, ", ")) |
| 1132 | } |
| 1133 | fmt.Fprintf(out, "%s: %t\n", cs.Bold("MaintainerCanModify"), params["maintainerCanModify"]) |
| 1134 | |
| 1135 | fmt.Fprintf(out, "%s\n", cs.Bold("Body:")) |
| 1136 | // Body |
| 1137 | var md string |
| 1138 | var err error |
| 1139 | if len(params["body"].(string)) == 0 { |
| 1140 | md = fmt.Sprintf("%s\n", cs.Muted("No description provided")) |
| 1141 | } else { |
| 1142 | md, err = markdown.Render(params["body"].(string), |
| 1143 | markdown.WithTheme(io.TerminalTheme()), |
| 1144 | markdown.WithWrap(io.TerminalWidth())) |
| 1145 | if err != nil { |
| 1146 | return err |
| 1147 | } |
| 1148 | } |
| 1149 | fmt.Fprintf(out, "%s", md) |
| 1150 | |
| 1151 | return nil |
| 1152 | } |
| 1153 | |
| 1154 | func previewPR(opts CreateOptions, openURL string) error { |
| 1155 | if opts.IO.IsStdinTTY() && opts.IO.IsStdoutTTY() { |
no test coverage detected