MCPcopy Create free account
hub / github.com/alibaba/open-code-review / parseReviewFlags

Function parseReviewFlags

cmd/opencodereview/compat_test.go:10–24  ·  view source on GitHub ↗

parseReviewFlags provides test compatibility: parses args through a fresh cobra command instance and returns the resulting reviewOptions.

(args []string)

Source from the content-addressed store, hash-verified

8// parseReviewFlags provides test compatibility: parses args through a fresh
9// cobra command instance and returns the resulting reviewOptions.
10func 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.

Calls 3

validateReviewOptionsFunction · 0.85
registerReviewFlagsFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected