-
Notifications
You must be signed in to change notification settings - Fork 0
1.1.0 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
1.1.0 #4
Conversation
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
- Add constructor to IOApp accepting version string - Implement showVersion() and showErrors() methods - Auto-inject --version/-v option in Options::create() - Support positional arguments in ParsedOptions - Enable running IOApp from file without explicit return - Update parse() to return Validation for better error handling - Use \r\n for cross-platform line endings
- Document version support and constructor - Add comprehensive command-line argument parsing examples - Document option formats (Required, Optional, NoInput, Negatable) - Explain accessing parsed options and positional arguments - Add examples for running IOApp from files - Document implicit IOApp instantiation - Show running plain IO values - Add argument passing examples
- Remove explicit return from first example - Reorder sections to show implicit instantiation as primary approach - Mark explicit return as optional - Update descriptions to reflect automatic detection
- Update error handling example to use parse() and showUsage() - Replace old best practices with argument DSL-first approach - Rewrite comprehensive example to showcase: - Version support in constructor - Multiple option types (Required, Optional, NoInput) - parse()->fold() pattern for error handling - Match expression for help/version flags - Option access with fetch() and has() - Verbose mode controlled by CLI flag - Proper IO composition with flatMap - Remove outdated io() function usage - Add Database class for complete working example - Progressive teaching: simple -> complex with consistent patterns
The explicit return statement is not needed - IOApp classes are automatically detected and instantiated by the console runner.
This documentation is specifically about IOApp, not about running plain IO values. Removed the section to keep focus on IOApp features.
Arguments and options are already comprehensively covered in the 'Command-Line Argument Parsing' section with proper examples using the DSL. The redundant section showed outdated raw args access.
Add note that using -v for verbose overrides the version shorthand, but --version long form remains available. This is an important detail for users defining their own options.
Add important note explaining that while -h/--help and -v/--version are automatically added to option definitions, users must explicitly check for them in run() using $options->has(). This gives users full control over when and how to display help/version information. Include example showing the recommended pattern with match expression.
Add parseAndHandle() convenience method that automatically handles --help/-h and --version/-v flags, eliminating the need for users to manually check for these flags in every application. Users can still use parse() directly if they need custom control over help/version behavior, but parseAndHandle() is now the recommended default approach. Updated documentation to show parseAndHandle() as the primary pattern, with parse() shown as an advanced option for custom control.
… error/help/version handling BREAKING CHANGE: parse() signature changed from Validation to IO<ParsedOptions> - parse() now handles errors, help, and version flags internally - Errors/help/version cause process exit with appropriate code - Only valid options reach the application code - Simplified usage: parse($args)->flatMap(fn($opts) => runApp($opts)) - Added parseValidation() for advanced users who need Validation - Updated all documentation and examples This makes the API much simpler - users don't need to remember to check for help/version flags or handle errors explicitly.
Update documentation to accurately reflect that parse() returns IO<ParsedOptions> and handles errors/help/version internally with process exit. Include correct usage example.
Update the command-line argument parsing example to use the new parse()->flatMap() pattern instead of the outdated fold() approach.
- Fix all remaining parse()->fold() references to parse()->flatMap() - Update 'Exit Codes and Error Handling' section to actually cover: - Exit code constants and their usage - Error handling with handleError() - Try-catch patterns within IO - Validation error handling - Use ExitSuccess constant instead of numeric 0 - Update Best Practices to reflect automatic error handling - Remove outdated Validation-based examples All documentation now consistently uses the new simplified API.
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.
No description provided.