(cmd *cobra.Command, flags toolApprovalFlags)
| 404 | } |
| 405 | |
| 406 | func resolveToolApprovalInput(cmd *cobra.Command, flags toolApprovalFlags) (json.RawMessage, error) { |
| 407 | inlineChanged := cmd.Flags().Lookup("input") != nil && cmd.Flags().Lookup("input").Changed |
| 408 | inputFile := strings.TrimSpace(flags.inputFile) |
| 409 | if inlineChanged && inputFile != "" { |
| 410 | return nil, toolspkg.NewValidationError( |
| 411 | "input", |
| 412 | toolspkg.ReasonSchemaInvalid, |
| 413 | "provide --input or --input-file, not both", |
| 414 | ) |
| 415 | } |
| 416 | if inlineChanged { |
| 417 | return parseToolInputJSON("input", flags.input) |
| 418 | } |
| 419 | if inputFile != "" { |
| 420 | return readToolInputFile(cmd, inputFile) |
| 421 | } |
| 422 | return nil, nil |
| 423 | } |
| 424 | |
| 425 | func readToolInputFile(cmd *cobra.Command, path string) (json.RawMessage, error) { |
| 426 | var payload []byte |
no test coverage detected