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

Function parseScanFlags

cmd/opencodereview/compat_test.go:38–53  ·  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

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

Calls 3

validateScanOptionsFunction · 0.85
registerScanFlagsFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected