diff --git a/CHANGELOG.md b/CHANGELOG.md index 38999ce..ebd641e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,27 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -**View all [Unreleased][] changes here** +## [1.2.0][] +#### Added +- Added `InputTypeFilterIterator` class +- Added `UnrecognisedInputException` exception + +#### Changed +- `InputCollection` now implements `Iterator` and `Countable` (implementing required methods) +- Removed use of `$type` in `InputCollection` +- Added `InputCollection::getItemsExcludeByType()` +- `InputCollection::getItemsByType()` and `InputCollection::getItems()` now returns an `Iterator` +- Renamed `InputCollection::append()` to `add()` and added `$position` flag +- Added `POSITION_APPEND` and `POSITION_PREPEND` flags to `InputCollection` +- Made `getCollection()`, `getInput()`, `find()`, and `validate()` in `AbstractInputHandler` final +- Removed all categorisation of items by type in `AbstractInputHandler::$input` +- Abstracted most of `AbstractInputHandler::validate()` into it's own protected method called `validateInput()` +- Removed `$skipValidation` argument from `AbstractInputHandler::bind()` and relaced with `$flags` +- Added `FLAG_BIND_SKIP_VALIDATION`, `FLAG_VALIDATION_SKIP_REQUIRED`, `FLAG_VALIDATION_SKIP_CUSTOM`, and `FLAG_VALIDATION_SKIP_UNRECOGNISED` flags to `AbstractInputHandler` +- Added check in `AbstractInputHandler::validate()` to look for unrecognised options and arguments +- Removed `InputHandlerFactory::FLAG_SKIP_VALIDATION` from `InputHandlerFactory` +- Passing flags in call from `InputHandlerFactory::build()` to `AbstractInputHandler::bind()` +- Updated `InputHandlerInterface::bind()` and `validate()` methods to support flags ## [1.1.4][] #### Fixed @@ -11,7 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [1.1.3][] #### Fixed -- Fixed logic bug that prevented `$index` and `$type` from being set in `InputCollection::append()`. This means replaceing items in an `InputCollection` now works as expected. +- Fixed logic bug that prevented `$index` and `$type` from being set in `InputCollection::append()`. This means replaceing items in an `InputCollection` now works as expected ## [1.1.2][] #### Added @@ -19,22 +39,22 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added `InputTypeInterface::getDisplayName()` method to standardise how the name of an `InputTypeInterface` class wants to display it's name #### Changed -- Updated validation logic for inputs that have a validator, no default, and are not set. +- Updated validation logic for inputs that have a validator, no default, and are not set - Throwing `InputValidationFailedException` exception when validation fails - Updated `RequiredInputMissingException` and `RequiredInputMissingValueException` exceptions to use `InputTypeInterface::getDisplayName()` when producing their message - Removed unused `RequiredArgumentMissingException` exception ## [1.1.1][] #### Changed -- `AbstractInputHandler::find()` returns NULL if it cannot find any input with the supplied name. It is easier to test for NULL than it is to catch an exception. +- `AbstractInputHandler::find()` returns NULL if it cannot find any input with the supplied name. It is easier to test for NULL than it is to catch an exception ## [1.1.0][] #### Added -- Expanded input types to include `Flag`, `IncrementingFlag`, and `LongOption`. +- Expanded input types to include `Flag`, `IncrementingFlag`, and `LongOption` - Added `InputTypeFactory` to help with loading input type classes #### Changed -- Updated to work with more than just `Argument` and `Option` input types. Makes use of `InputTypeFactory` to allow addition of new types as needed. +- Updated to work with more than just `Argument` and `Option` input types. Makes use of `InputTypeFactory` to allow addition of new types as needed ## [1.0.2][] #### Changed @@ -53,7 +73,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). #### Added - Initial release -[Unreleased]: https://github.com/pointybeard/helpers-functions-cli/compare/1.1.4...integration +[1.2.0]: https://github.com/pointybeard/helpers-functions-cli/compare/1.1.4...1.2.0 [1.1.4]: https://github.com/pointybeard/helpers-functions-cli/compare/1.1.3...1.1.4 [1.1.3]: https://github.com/pointybeard/helpers-functions-cli/compare/1.1.2...1.1.3 [1.1.2]: https://github.com/pointybeard/helpers-functions-cli/compare/1.1.1...1.1.2 diff --git a/README.md b/README.md index 8cc2e4b..e58ef69 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # PHP Helpers: Command-line Input and Input Type Handlers -- Version: v1.1.4 -- Date: May 27 2019 +- Version: v1.2.0 +- Date: June 01 2019 - [Release notes](https://github.com/pointybeard/helpers-cli-input/blob/master/CHANGELOG.md) - [GitHub repository](https://github.com/pointybeard/helpers-cli-input) @@ -9,7 +9,7 @@ Collection of classes for handling argv (and other) input when calling command-l ## Installation -This library is installed via [Composer](http://getcomposer.org/). To install, use `composer require pointybeard/helpers-cli-input` or add `"pointybeard/helpers-cli-input": "~1.1"` to your `composer.json` file. +This library is installed via [Composer](http://getcomposer.org/). To install, use `composer require pointybeard/helpers-cli-input` or add `"pointybeard/helpers-cli-input": "~1.2.0"` to your `composer.json` file. And run composer to update your dependencies: @@ -26,7 +26,7 @@ To include all the [PHP Helpers](https://github.com/pointybeard/helpers) package Include this library in your PHP files with `use pointybeard\Helpers\Cli`. See example code in `example/example.php`. The example code can be run with the following command: - php -f example/example.php -- -vvvs -d example/example.json import + php -f example/example.php -- -vvv -d example/example.json import ## Support diff --git a/composer.json b/composer.json index 8604f6f..094ef88 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "pointybeard/helpers-cli-input", - "version": "1.1.4", + "version": "1.2.0", "description": "Collection of classes for handling argv (and other) input when calling command-line scripts. Helps with parsing, collecting and validating arguments, options, and flags.", "homepage": "https://github.com/pointybeard/helpers-cli-input", "license": "MIT", @@ -14,14 +14,14 @@ ], "require": { "php": ">=7.2", - "pointybeard/helpers-foundation-factory": "~1", - "pointybeard/helpers-functions-flags": "~1" + "pointybeard/helpers-foundation-factory": "~1.0", + "pointybeard/helpers-functions-flags": "~1.0" }, "require-dev": { "phpunit/phpunit": "^8", - "pointybeard/helpers-functions-strings": "^1", - "pointybeard/helpers-cli-colour": "^1", - "pointybeard/helpers-functions-cli": "^1" + "pointybeard/helpers-functions-strings": "~1.1.0", + "pointybeard/helpers-cli-colour": "~1.0", + "pointybeard/helpers-functions-cli": "~1.1.0" }, "support": { "issues": "https://github.com/pointybeard/helpers-cli-input/issues",