@@ -125,7 +125,8 @@ func NewRootCmd() *cobra.Command {
125
125
gh combine owner/repo --output table # Output stats in table format (default)
126
126
gh combine owner/repo --combine-branch-name combined-prs # Use a different name for the combined PR branch
127
127
gh combine owner/repo --working-branch-suffix -working # Use a different suffix for the working branch
128
- gh combine owner/repo --update-branch # Update the branch of the combined PR` ,
128
+ gh combine owner/repo --update-branch # Update the branch of the combined PR
129
+ gh combine --version # Display version information` ,
129
130
RunE : runCombine ,
130
131
}
131
132
@@ -158,11 +159,8 @@ func NewRootCmd() *cobra.Command {
158
159
rootCmd .Flags ().StringVar (& outputFormat , "output" , "table" , "Output format: table, plain, or json" )
159
160
rootCmd .Flags ().BoolVar (& dryRun , "dry-run" , false , "Simulate the actions without making any changes" )
160
161
161
- // Add deprecated flags for backward compatibility
162
- // rootCmd.Flags().IntVar(&minimum, "min-combine", 2, "Minimum number of PRs to combine (deprecated, use --minimum)")
163
-
164
- // Mark deprecated flags
165
- // rootCmd.Flags().MarkDeprecated("min-combine", "use --minimum instead")
162
+ // Add version flag
163
+ rootCmd .Flags ().BoolP ("version" , "v" , false , "Display version information" )
166
164
167
165
return rootCmd
168
166
}
@@ -178,6 +176,15 @@ func runCombine(cmd *cobra.Command, args []string) error {
178
176
ctx , cancel := SetupSignalContext ()
179
177
defer cancel ()
180
178
179
+ // Check for version flag before executing the command
180
+ if cmd .Flags ().Lookup ("version" ) != nil {
181
+ versionFlagValue , err := cmd .Flags ().GetBool ("version" )
182
+ if err == nil && versionFlagValue {
183
+ fmt .Println (version .String ())
184
+ return nil
185
+ }
186
+ }
187
+
181
188
Logger .Debug ("starting gh-combine" , "version" , version .String ())
182
189
183
190
if dependabot && branchPrefix == "" {
@@ -425,7 +432,7 @@ func buildCommandString(args []string) string {
425
432
cmd = append (cmd , args ... )
426
433
427
434
// Only add branch-prefix if it's not due to the dependabot flag
428
- if branchPrefix != "" && ! ( dependabot && branchPrefix = = "dependabot/" ) {
435
+ if branchPrefix != "" && ( ! dependabot || branchPrefix ! = "dependabot/" ) {
429
436
cmd = append (cmd , "--branch-prefix" , branchPrefix )
430
437
}
431
438
if branchSuffix != "" {
0 commit comments