diff --git a/.gitignore b/.gitignore index 42dad327..279e562a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ tests/_log/* tests/_helpers/_generated/* *.phar .phpunit.result.cache +phpunit.xml +phpdoc.xml diff --git a/RoboFile.php b/RoboFile.php index a7a38fde..57ae282d 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -111,15 +111,15 @@ public function release(ConsoleIO $io, $opts = ['beta' => false]) ->run(); if ($stable) { - $this->pharPublish($io); + $this->pharBuild($io); } - // Skip publishing site until it works again. - // $this->publish($io); + $this->publish($io); $this->collectionBuilder($io)->taskGitStack() ->tag($version) - ->push('origin ' . self::MAIN_BRANCH . ' --tags') + ->push('origin ' . self::MAIN_BRANCH) + ->push('origin ' . $version) ->run(); if ($stable) { @@ -470,23 +470,6 @@ public function pharInstall(ConsoleIO $io) */ public function pharPublish(ConsoleIO $io) { - $this->pharBuild($io); - - $this->collectionBuilder($io) - ->taskFilesystemStack() - ->remove('robo-release.phar') - ->rename('robo.phar', 'robo-release.phar') - ->taskGitStack() - ->checkout('site') - ->pull('origin site') - ->taskFilesystemStack() - ->remove('robotheme/robo.phar') - ->rename('robo-release.phar', 'robotheme/robo.phar') - ->taskGitStack() - ->add('robotheme/robo.phar') - ->commit('Update robo.phar to ' . \Robo\Robo::version()) - ->push('origin site') - ->checkout(self::MAIN_BRANCH) - ->run(); + throw new \Exception("phar:publish is obsolete."); } } diff --git a/composer.json b/composer.json index b0464aaa..d64307c8 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ ], "require": { "php": ">=8.0", - "consolidation/annotated-command": "^4.7", + "consolidation/annotated-command": "4.8.1", "consolidation/config": "^2.0.1", "consolidation/log": "^2.0.2 || ^3", "consolidation/output-formatters": "^4.1.2", @@ -54,6 +54,10 @@ "@lint", "@unit", "@cs" + ], + "phpdoc": "build/tools/phpdoc", + "install-tools": [ + "if [[ ! -f build/tools/phpdoc ]] ; then mkdir -p build/tools && wget --output-document=build/tools/phpdoc https://phpdoc.org/phpDocumentor.phar && chmod +x build/tools/phpdoc; fi" ] }, "config": { diff --git a/composer.lock b/composer.lock index 3e9b00f4..9770a1ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3e22a726dd5689cd00574614b2f922f2", + "content-hash": "c8e7ed4578fce4601bee132e075e8402", "packages": [ { "name": "composer/semver", @@ -89,16 +89,16 @@ }, { "name": "consolidation/annotated-command", - "version": "4.7.1", + "version": "4.8.1", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "fd263e3e9341d29758025b1a9b2878e3247525be" + "reference": "8fefdcff0cdb61bc04e34323f626404d536786a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/fd263e3e9341d29758025b1a9b2878e3247525be", - "reference": "fd263e3e9341d29758025b1a9b2878e3247525be", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/8fefdcff0cdb61bc04e34323f626404d536786a5", + "reference": "8fefdcff0cdb61bc04e34323f626404d536786a5", "shasum": "" }, "require": { @@ -139,9 +139,9 @@ "description": "Initialize Symfony Console commands from annotated command class methods.", "support": { "issues": "https://github.com/consolidation/annotated-command/issues", - "source": "https://github.com/consolidation/annotated-command/tree/4.7.1" + "source": "https://github.com/consolidation/annotated-command/tree/4.8.1" }, - "time": "2022-12-06T22:57:25+00:00" + "time": "2023-02-28T15:36:38+00:00" }, { "name": "consolidation/config", @@ -257,41 +257,36 @@ }, { "name": "consolidation/output-formatters", - "version": "4.2.3", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "cbb50cc86775f14972003f797b61e232788bee1f" + "reference": "b377db7e9435c50c4e019c26ec164b547e754ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/cbb50cc86775f14972003f797b61e232788bee1f", - "reference": "cbb50cc86775f14972003f797b61e232788bee1f", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/b377db7e9435c50c4e019c26ec164b547e754ca0", + "reference": "b377db7e9435c50c4e019c26ec164b547e754ca0", "shasum": "" }, "require": { "dflydev/dot-access-data": "^1.1.0 || ^2 || ^3", "php": ">=7.1.3", - "symfony/console": "^4|^5|^6", - "symfony/finder": "^4|^5|^6" + "symfony/console": "^4 || ^5 || ^6", + "symfony/finder": "^4 || ^5 || ^6" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4.2", - "phpunit/phpunit": ">=7", + "phpunit/phpunit": "^7 || ^8 || ^9", "squizlabs/php_codesniffer": "^3", - "symfony/var-dumper": "^4|^5|^6", - "symfony/yaml": "^4|^5|^6", - "yoast/phpunit-polyfills": "^0.2.0" + "symfony/var-dumper": "^4 || ^5 || ^6", + "symfony/yaml": "^4 || ^5 || ^6", + "yoast/phpunit-polyfills": "^1" }, "suggest": { "symfony/var-dumper": "For using the var_dump formatter" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - } - }, "autoload": { "psr-4": { "Consolidation\\OutputFormatters\\": "src" @@ -310,22 +305,22 @@ "description": "Format text by applying transformations provided by plug-in formatters.", "support": { "issues": "https://github.com/consolidation/output-formatters/issues", - "source": "https://github.com/consolidation/output-formatters/tree/4.2.3" + "source": "https://github.com/consolidation/output-formatters/tree/4.2.4" }, - "time": "2022-10-17T04:01:40+00:00" + "time": "2023-02-24T03:39:10+00:00" }, { "name": "consolidation/self-update", - "version": "2.0.5", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/consolidation/self-update.git", - "reference": "8a64bdd8daf5faa8e85f56534dd99caf928164b3" + "reference": "714b09fdf0513f83292874bb12de0566066040c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/self-update/zipball/8a64bdd8daf5faa8e85f56534dd99caf928164b3", - "reference": "8a64bdd8daf5faa8e85f56534dd99caf928164b3", + "url": "https://api.github.com/repos/consolidation/self-update/zipball/714b09fdf0513f83292874bb12de0566066040c2", + "reference": "714b09fdf0513f83292874bb12de0566066040c2", "shasum": "" }, "require": { @@ -365,9 +360,9 @@ "description": "Provides a self:update command for Symfony Console applications.", "support": { "issues": "https://github.com/consolidation/self-update/issues", - "source": "https://github.com/consolidation/self-update/tree/2.0.5" + "source": "https://github.com/consolidation/self-update/tree/2.1.0" }, - "time": "2022-02-09T22:44:24+00:00" + "time": "2023-02-21T19:33:55+00:00" }, { "name": "dflydev/dot-access-data", @@ -889,16 +884,16 @@ }, { "name": "symfony/console", - "version": "v6.0.16", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "be294423f337dda97c810733138c0caec1bb0575" + "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/be294423f337dda97c810733138c0caec1bb0575", - "reference": "be294423f337dda97c810733138c0caec1bb0575", + "url": "https://api.github.com/repos/symfony/console/zipball/c3ebc83d031b71c39da318ca8b7a07ecc67507ed", + "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed", "shasum": "" }, "require": { @@ -964,7 +959,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.0.16" + "source": "https://github.com/symfony/console/tree/v6.0.19" }, "funding": [ { @@ -980,20 +975,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T18:58:46+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.0.9", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "5c85b58422865d42c6eb46f7693339056db098a8" + "reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5c85b58422865d42c6eb46f7693339056db098a8", - "reference": "5c85b58422865d42c6eb46f7693339056db098a8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2eaf8e63bc5b8cefabd4a800157f0d0c094f677a", + "reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a", "shasum": "" }, "require": { @@ -1047,7 +1042,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.9" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.19" }, "funding": [ { @@ -1063,7 +1058,7 @@ "type": "tidelift" } ], - "time": "2022-05-05T16:45:52+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -1146,16 +1141,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.0.13", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "3adca49133bd055ebe6011ed1e012be3c908af79" + "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3adca49133bd055ebe6011ed1e012be3c908af79", - "reference": "3adca49133bd055ebe6011ed1e012be3c908af79", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3d49eec03fda1f0fc19b7349fbbe55ebc1004214", + "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214", "shasum": "" }, "require": { @@ -1189,7 +1184,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.0.13" + "source": "https://github.com/symfony/filesystem/tree/v6.0.19" }, "funding": [ { @@ -1205,20 +1200,20 @@ "type": "tidelift" } ], - "time": "2022-09-21T20:25:27+00:00" + "time": "2023-01-20T17:44:14+00:00" }, { "name": "symfony/finder", - "version": "v6.0.11", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1" + "reference": "5cc9cac6586fc0c28cd173780ca696e419fefa11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/09cb683ba5720385ea6966e5e06be2a34f2568b1", - "reference": "09cb683ba5720385ea6966e5e06be2a34f2568b1", + "url": "https://api.github.com/repos/symfony/finder/zipball/5cc9cac6586fc0c28cd173780ca696e419fefa11", + "reference": "5cc9cac6586fc0c28cd173780ca696e419fefa11", "shasum": "" }, "require": { @@ -1250,7 +1245,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.0.11" + "source": "https://github.com/symfony/finder/tree/v6.0.19" }, "funding": [ { @@ -1266,7 +1261,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:39:48+00:00" + "time": "2023-01-20T17:44:14+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1679,16 +1674,16 @@ }, { "name": "symfony/process", - "version": "v6.0.11", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "44270a08ccb664143dede554ff1c00aaa2247a43" + "reference": "2114fd60f26a296cc403a7939ab91478475a33d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/44270a08ccb664143dede554ff1c00aaa2247a43", - "reference": "44270a08ccb664143dede554ff1c00aaa2247a43", + "url": "https://api.github.com/repos/symfony/process/zipball/2114fd60f26a296cc403a7939ab91478475a33d4", + "reference": "2114fd60f26a296cc403a7939ab91478475a33d4", "shasum": "" }, "require": { @@ -1720,7 +1715,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.0.11" + "source": "https://github.com/symfony/process/tree/v6.0.19" }, "funding": [ { @@ -1736,7 +1731,7 @@ "type": "tidelift" } ], - "time": "2022-06-27T17:10:44+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/service-contracts", @@ -1822,16 +1817,16 @@ }, { "name": "symfony/string", - "version": "v6.0.15", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "51ac0fa0ccf132a00519b87c97e8f775fa14e771" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/51ac0fa0ccf132a00519b87c97e8f775fa14e771", - "reference": "51ac0fa0ccf132a00519b87c97e8f775fa14e771", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { @@ -1887,7 +1882,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.15" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -1903,20 +1898,20 @@ "type": "tidelift" } ], - "time": "2022-10-10T09:34:08+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/yaml", - "version": "v6.0.16", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b" + "reference": "deec3a812a0305a50db8ae689b183f43d915c884" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b", - "reference": "eb85bd1b0b297e976f3ada52ad239ef80b4dbd0b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/deec3a812a0305a50db8ae689b183f43d915c884", + "reference": "deec3a812a0305a50db8ae689b183f43d915c884", "shasum": "" }, "require": { @@ -1961,7 +1956,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.0.16" + "source": "https://github.com/symfony/yaml/tree/v6.0.19" }, "funding": [ { @@ -1977,36 +1972,36 @@ "type": "tidelift" } ], - "time": "2022-11-25T18:58:46+00:00" + "time": "2023-01-11T11:50:03+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -2033,7 +2028,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -2049,20 +2044,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -2100,7 +2095,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -2108,7 +2103,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "natxet/cssmin", @@ -2861,16 +2856,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.31", + "version": "8.5.33", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e" + "reference": "7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33c126b09a42de5c99e5e8032b54e8221264a74e", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e", + "reference": "7d1ff0e8c6b35db78ff13e3e05517d7cbf7aa32e", "shasum": "" }, "require": { @@ -2938,7 +2933,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.31" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.33" }, "funding": [ { @@ -2954,7 +2949,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T05:57:37+00:00" + "time": "2023-02-27T13:04:50+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3687,16 +3682,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -3732,14 +3727,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "theseer/tokenizer", diff --git a/examples/src/Robo/Plugin/Commands/ExampleCommands.php b/examples/src/Robo/Plugin/Commands/ExampleCommands.php index 6cd6585f..d31f7df7 100644 --- a/examples/src/Robo/Plugin/Commands/ExampleCommands.php +++ b/examples/src/Robo/Plugin/Commands/ExampleCommands.php @@ -4,6 +4,7 @@ use Robo\Result; use Consolidation\AnnotatedCommand\CommandData; +use Consolidation\AnnotatedCommand\CommandResult; use Consolidation\OutputFormatters\Options\FormatterOptions; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Consolidation\OutputFormatters\StructuredData\PropertyList; @@ -335,15 +336,79 @@ function ($key, $cellData, FormatterOptions $options) { } /** - * Demonstrate Robo formatters. Default format is 'table'. + * Test the contents of the $options array * * @field-labels + * options: Options + * @default-table-fields options + * @default-string-field second + * @usage try:formatters --format=yaml + * @usage try:formatters --format=csv + * @usage try:formatters --fields=first,third + * @usage try:formatters --fields=III,II + * @aliases tf + * + * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields + */ + public function tryOptionValues($somthing = 'default', $options = ['format' => 'table', 'fields' => 'options']) + { + var_export($options); + $data = [ + 'options' => $options, + ]; + return (new RowsOfFields($data))->addRendererFunction( + function ($key, $cellData) { + if (!is_string($cellData)) { + return var_export($cellData, true); + } + return $cellData; + } + ); + } + + + /** + * Test command with formatters + * + * @command example:table + * @param $unused An unused argument + * @field-labels * first: I * second: II * third: III * fourth: IV * @default-table-fields first,second,third * @default-fields first,second,third,fourth + * @usage example:table --format=yml + * Show the example table in yml format. + * @usage example:table --fields=first,third + * Show only the first and third fields in the table. + * @usage example:table --fields=II,III + * Note that either the field ID or the visible field label may be used. + * @aliases extab + * @topics docs-tables + * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields Fully-qualified class name + */ + public function exampleTable($unused = '', $options = ['format' => 'table', 'fields' => '']) + { + $outputData = [ + 'en' => [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three', 'fourth' => 'Four', ], + 'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei', 'fourth' => 'Vier', ], + 'jp' => [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San', 'fourth' => 'Shi', ], + 'es' => [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres', 'fourth' => 'Quatro', ], + ]; + return CommandResult::data(new RowsOfFields($outputData)); + } + + /** + * Demonstrate Robo formatters. Default format is 'table'. + * + * @field-labels + * first: I + * second: II + * third: III + * fourth: IV + * @default-fields first,third,fourth * @default-string-field second * @usage try:formatters --format=yaml * @usage try:formatters --format=csv @@ -353,8 +418,11 @@ function ($key, $cellData, FormatterOptions $options) { * * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields */ - public function tryFormatters($somthing = 'default', $options = ['format' => 'table', 'fields' => '']) + public function tryFormatters(InputInterface $input, $somthing = 'default', $options = ['format' => 'table', 'fields' => '']) { + var_export($input->getParameterOption('fields')); + + var_export($options); $outputData = [ 'en' => [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three', 'fourth' => 'Four', ], 'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei', 'fourth' => 'Vier', ], diff --git a/src/Robo.php b/src/Robo.php index 336cf1a0..e172fb52 100644 --- a/src/Robo.php +++ b/src/Robo.php @@ -26,7 +26,7 @@ class Robo { const APPLICATION_NAME = 'Robo'; - private const VERSION = '4.0.4-dev'; + private const VERSION = '4.0.4'; /** * The currently active container object, or NULL if not initialized yet. @@ -521,7 +521,7 @@ public static function process(Process $process) */ public static function register($app, $handler) { - $container = Robo::getContainer(); + $container = static::getContainer(); $instance = static::instantiate($handler); if (!$instance) { return;