parseScanFlags provides test compatibility: parses args through a fresh cobra command instance and returns the resulting scanOptions.
(args []string)
| 52 | // parseScanFlags provides test compatibility: parses args through a fresh |
| 53 | // cobra command instance and returns the resulting scanOptions. |
| 54 | func 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 | |
| 71 | type configParseError struct{ msg string } |
| 72 |
no test coverage detected