feat: Add interactive CLI forms for scenario parameter collection#81
Open
tsebastiani wants to merge 4 commits intomainfrom
Open
feat: Add interactive CLI forms for scenario parameter collection#81tsebastiani wants to merge 4 commits intomainfrom
tsebastiani wants to merge 4 commits intomainfrom
Conversation
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
- Add extensive unit tests for forms package functionality - Test form creation, field separation, and validation logic - Cover edge cases including malformed fields and invalid values - Test all field types: string, number, boolean, enum, file validation - Validate predefined values and default value handling - Test environment variable conversion and form result operations - 37.1% statement coverage with 100% coverage on pure functions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new interactive CLI forms system that allows users to collect scenario parameters through guided prompts instead of CLI flags. The feature is accessible via the new
--formflag in theruncommand.Key Features
🎯 Interactive Parameter Collection
[default_value]>prompting🔍 Comprehensive Validation
🛡️ Security & UX
*for sensitive parametersImplementation Details
New Package:
pkg/formsForm: Manages RequiredItems, OptionalItems, and GlobalItems arraysFormPromptItem: Wraps InputField with optional predefined valuesFormResult: Collects validated values mapped by environment variable namesNewForm(): Creates form with automatic field separation by Required flagIntegration with
cmd/run.go--formflag enables interactive mode instead of CLI flagsParsedFieldformat used by traditional flagsUser Experience Flow
Testing
Comprehensive test suite with 37.1% statement coverage:
Backwards Compatibility
--formflagInputField.Validate()methodsFuture Enhancements
This forms foundation enables future features like: