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

Function parseScanFlags

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

52// parseScanFlags provides test compatibility: parses args through a fresh
53// cobra command instance and returns the resulting scanOptions.
54func parseScanFlags(args []string) (scanOptions, error) {
55 var opts scanOptions
56 cmd := &cobra.Command{
57 Use: "scan",
58 SilenceUsage: true,
59 SilenceErrors: true,
60 RunE: func(cmd *cobra.Command, args []string) error {
61 return validateScanOptions(&opts)
62 },
63 }
64 registerScanFlags(cmd, &opts)
65 cmd.SetArgs(args)
66 cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {})
67 err := cmd.Execute()
68 return opts, err
69}
70
71type configParseError struct{ msg string }
72

Calls 3

validateScanOptionsFunction · 0.85
registerScanFlagsFunction · 0.85
ExecuteMethod · 0.65

Tested by

no test coverage detected