parseReviewFlags provides test compatibility: parses args through a fresh cobra command instance and returns the resulting reviewOptions.
(args []string)
| 8 | // parseReviewFlags provides test compatibility: parses args through a fresh |
| 9 | // cobra command instance and returns the resulting reviewOptions. |
| 10 | func parseReviewFlags(args []string) (reviewOptions, error) { |
| 11 | var opts reviewOptions |
| 12 | cmd := &cobra.Command{ |
| 13 | Use: "review", |
| 14 | SilenceUsage: true, |
| 15 | SilenceErrors: true, |
| 16 | RunE: func(cmd *cobra.Command, args []string) error { |
| 17 | return validateReviewOptions(&opts) |
| 18 | }, |
| 19 | } |
| 20 | registerReviewFlags(cmd, &opts) |
| 21 | cmd.SetArgs(args) |
| 22 | err := cmd.Execute() |
| 23 | return opts, err |
| 24 | } |
| 25 | |
| 26 | // runReview provides test compatibility for the pre-cobra runReview(args) |
| 27 | // entry point: parse flags, then execute the review. |
no test coverage detected