parseScanFlags provides test compatibility: parses args through a fresh cobra command instance and returns the resulting scanOptions.
(args []string)
| 33 | // parseScanFlags provides test compatibility: parses args through a fresh |
| 34 | // cobra command instance and returns the resulting scanOptions. |
| 35 | func 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. |
| 53 | func runSessionListCompat(args []string) error { |
no test coverage detected