| 168 | } |
| 169 | |
| 170 | func validateScanOptions(opts *scanOptions) error { |
| 171 | if err := validateAudience(opts.audience); err != nil { |
| 172 | return err |
| 173 | } |
| 174 | normalizedFormat, err := validateOutputFormat(opts.outputFormat) |
| 175 | if err != nil { |
| 176 | return err |
| 177 | } |
| 178 | opts.outputFormat = normalizedFormat |
| 179 | if opts.maxTools < 0 { |
| 180 | return fmt.Errorf("--max-tools must be a non-negative integer (0 means use template default)") |
| 181 | } |
| 182 | if opts.maxGitProcs < 0 { |
| 183 | return fmt.Errorf("--max-git-procs must be a non-negative integer (0 means use default 16)") |
| 184 | } |
| 185 | if opts.maxTokens < 0 { |
| 186 | return fmt.Errorf("--max-tokens must be a non-negative integer (0 means use configured or template default)") |
| 187 | } |
| 188 | if opts.preview && opts.resume != "" { |
| 189 | return fmt.Errorf("--preview and --resume cannot be used together") |
| 190 | } |
| 191 | if opts.maxTokensBudget < 0 { |
| 192 | return fmt.Errorf("--max-tokens-budget must be a non-negative integer (0 means unlimited)") |
| 193 | } |
| 194 | return nil |
| 195 | } |
| 196 | |
| 197 | func validateDelegateOptions(opts *delegateOptions) error { |
| 198 | opts.to = normalizeDiffTarget(opts.from, opts.to, opts.commit) |