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