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

Function parseScanFlags

cmd/opencodereview/compat_test.go:35–50  ·  view source on GitHub ↗

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

(args []string)

Source from the content-addressed store, hash-verified

33// parseScanFlags provides test compatibility: parses args through a fresh
34// cobra command instance and returns the resulting scanOptions.
35func parseScanFlags(args []string) (scanOptions, error) {
36 var opts scanOptions
37 cmd := &cobra.Command{
38 Use: "scan",
39 SilenceUsage: true,
40 SilenceErrors: true,
41 RunE: func(cmd *cobra.Command, args []string) error {
42 return validateScanOptions(&opts)
43 },
44 }
45 registerScanFlags(cmd, &opts)
46 cmd.SetArgs(args)
47 cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {})
48 err := cmd.Execute()
49 return opts, err
50}
51
52// runSessionListCompat provides test compatibility for old-style runSessionList([]string{...}) calls.
53func runSessionListCompat(args []string) error {

Calls 3

validateScanOptionsFunction · 0.85
registerScanFlagsFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected