(opts delegateOptions)
| 154 | } |
| 155 | |
| 156 | func executeDelegatePreview(opts delegateOptions) error { |
| 157 | dc, err := loadDelegateContext(opts) |
| 158 | if err != nil { |
| 159 | return err |
| 160 | } |
| 161 | |
| 162 | ctx := context.Background() |
| 163 | preview, err := dc.preview(ctx) |
| 164 | if err != nil { |
| 165 | return fmt.Errorf("preview failed: %w", err) |
| 166 | } |
| 167 | |
| 168 | fmt.Printf("# Files (%d reviewable / %d total)\n\n", preview.ReviewableCount, preview.TotalFiles) |
| 169 | fmt.Printf("- mode: %s\n", dc.reviewMode()) |
| 170 | if dc.opts.from != "" { |
| 171 | fmt.Printf("- from: %s\n", dc.opts.from) |
| 172 | } |
| 173 | if dc.opts.to != "" { |
| 174 | fmt.Printf("- to: %s\n", dc.opts.to) |
| 175 | } |
| 176 | if dc.opts.commit != "" { |
| 177 | fmt.Printf("- commit: %s\n", dc.opts.commit) |
| 178 | } |
| 179 | if mergeBase := dc.mergeBase(ctx); mergeBase != "" { |
| 180 | fmt.Printf("- merge_base: %s\n", mergeBase) |
| 181 | } |
| 182 | if dc.opts.background != "" { |
| 183 | fmt.Printf("- background: %s\n", dc.opts.background) |
| 184 | } |
| 185 | fmt.Printf("- total_insertions: %d\n", preview.TotalInsertions) |
| 186 | fmt.Printf("- total_deletions: %d\n\n", preview.TotalDeletions) |
| 187 | |
| 188 | for _, entry := range preview.Entries { |
| 189 | marker := " " |
| 190 | if !entry.WillReview { |
| 191 | marker = "~~" |
| 192 | } |
| 193 | fmt.Printf("%s- `%s` [%s] +%d/-%d", marker, entry.Path, entry.Status, entry.Insertions, entry.Deletions) |
| 194 | if !entry.WillReview { |
| 195 | fmt.Printf(" (excluded: %s)", entry.ExcludeReason) |
| 196 | fmt.Print("~~") |
| 197 | } |
| 198 | fmt.Println() |
| 199 | } |
| 200 | |
| 201 | return nil |
| 202 | } |
| 203 | |
| 204 | func executeDelegateRule(opts delegateOptions, paths []string) error { |
| 205 | dc, err := loadDelegateContext(opts) |
no test coverage detected