|
35 | 35 | workingBranchSuffix string
|
36 | 36 | dependabot bool
|
37 | 37 | caseSensitiveLabels bool
|
| 38 | + noColor bool |
| 39 | + noStats bool |
38 | 40 | )
|
39 | 41 |
|
40 | 42 | // NewRootCmd creates the root command for the gh-combine CLI
|
@@ -96,6 +98,8 @@ func NewRootCmd() *cobra.Command {
|
96 | 98 | # Additional options
|
97 | 99 | gh combine owner/repo --autoclose # Close source PRs when combined PR is merged
|
98 | 100 | gh combine owner/repo --base-branch main # Use a different base branch for the combined PR
|
| 101 | + gh combine owner/repo --no-color # Disable color output |
| 102 | + gh combine owner/repo --no-stats # Disable stats summary display |
99 | 103 | gh combine owner/repo --combine-branch-name combined-prs # Use a different name for the combined PR branch
|
100 | 104 | gh combine owner/repo --working-branch-suffix -working # Use a different suffix for the working branch
|
101 | 105 | gh combine owner/repo --update-branch # Update the branch of the combined PR`,
|
@@ -127,6 +131,8 @@ func NewRootCmd() *cobra.Command {
|
127 | 131 | rootCmd.Flags().IntVar(&minimum, "minimum", 2, "Minimum number of PRs to combine")
|
128 | 132 | rootCmd.Flags().StringVar(&defaultOwner, "owner", "", "Default owner for repositories (if not specified in repo name or missing from file inputs)")
|
129 | 133 | rootCmd.Flags().BoolVar(&caseSensitiveLabels, "case-sensitive-labels", false, "Use case-sensitive label matching")
|
| 134 | + rootCmd.Flags().BoolVar(&noColor, "no-color", false, "Disable color output") |
| 135 | + rootCmd.Flags().BoolVar(&noStats, "no-stats", false, "Disable stats summary display") |
130 | 136 |
|
131 | 137 | // Add deprecated flags for backward compatibility
|
132 | 138 | // rootCmd.Flags().IntVar(&minimum, "min-combine", 2, "Minimum number of PRs to combine (deprecated, use --minimum)")
|
@@ -177,6 +183,10 @@ func runCombine(cmd *cobra.Command, args []string) error {
|
177 | 183 | return fmt.Errorf("command execution failed: %w", err)
|
178 | 184 | }
|
179 | 185 |
|
| 186 | + if !noStats { |
| 187 | + displayStatsSummary() |
| 188 | + } |
| 189 | + |
180 | 190 | return nil
|
181 | 191 | }
|
182 | 192 |
|
@@ -343,3 +353,27 @@ func fetchOpenPullRequests(ctx context.Context, client *api.RESTClient, repo git
|
343 | 353 |
|
344 | 354 | return allPulls, nil
|
345 | 355 | }
|
| 356 | + |
| 357 | +func displayStatsSummary() { |
| 358 | + // Example implementation of stats summary display |
| 359 | + if noColor { |
| 360 | + fmt.Println("Stats Summary (Color Disabled):") |
| 361 | + } else { |
| 362 | + fmt.Println("\033[1;34mStats Summary:\033[0m") // Blue color for title |
| 363 | + } |
| 364 | + |
| 365 | + // Example stats data |
| 366 | + fmt.Println("Repositories Processed: 5") |
| 367 | + fmt.Println("PRs Combined: 10") |
| 368 | + fmt.Println("PRs Skipped (Merge Conflicts): 2") |
| 369 | + fmt.Println("PRs Skipped (Criteria Not Met): 3") |
| 370 | + fmt.Println("Execution Time: 1m30s") |
| 371 | + |
| 372 | + if !noColor { |
| 373 | + fmt.Println("\033[1;32mLinks to Combined PRs:\033[0m") // Green color for links section |
| 374 | + } else { |
| 375 | + fmt.Println("Links to Combined PRs:") |
| 376 | + } |
| 377 | + fmt.Println("- https://github.com/owner/repo1/pull/123") |
| 378 | + fmt.Println("- https://github.com/owner/repo2/pull/456") |
| 379 | +} |
0 commit comments