Skip to content

Add option validation for commands - #10

Merged
eliothedeman merged 1 commit into
masterfrom
claude/add-option-validation-01Ty7eqgBurzVbJYkPtX4yW8
Dec 1, 2025
Merged

Add option validation for commands#10
eliothedeman merged 1 commit into
masterfrom
claude/add-option-validation-01Ty7eqgBurzVbJYkPtX4yW8

Conversation

@eliothedeman

Copy link
Copy Markdown
Owner

…nterface

This change adds the ability to validate individual options on commands when the command itself doesn't implement the Validator interface. Previously, the Validator interface was only checked at the command level.

Changes:

  • Added validateOptions() method to check each option that implements Validator
  • Integrated validation into both Cobra and Urfave bindings
  • Validation runs after parsing but before command execution
  • If the command implements Validator, option validation is skipped
  • Added comprehensive tests for both Cobra and Urfave bindings

The validation respects the following behavior:

  1. If command doesn't implement Validator: validate each option individually
  2. If command implements Validator: skip individual option validation
  3. Validation errors are properly returned with descriptive messages

…nterface

This change adds the ability to validate individual options on commands when
the command itself doesn't implement the Validator interface. Previously,
the Validator interface was only checked at the command level.

Changes:
- Added validateOptions() method to check each option that implements Validator
- Integrated validation into both Cobra and Urfave bindings
- Validation runs after parsing but before command execution
- If the command implements Validator, option validation is skipped
- Added comprehensive tests for both Cobra and Urfave bindings

The validation respects the following behavior:
1. If command doesn't implement Validator: validate each option individually
2. If command implements Validator: skip individual option validation
3. Validation errors are properly returned with descriptive messages
@eliothedeman
eliothedeman merged commit 1c8689f into master Dec 1, 2025
1 check passed
@eliothedeman
eliothedeman deleted the claude/add-option-validation-01Ty7eqgBurzVbJYkPtX4yW8 branch December 1, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants