Skip to content
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

[TASK] Finalize extension:list command #322

Merged
merged 1 commit into from
Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ script:
- ./typo3cms configuration:set BE/installToolPassword foobar && grep installToolPassword $TYPO3_PATH_WEB/typo3conf/LocalConfiguration.php | grep foobar
- ./typo3cms configuration:remove BE/installToolPassword --force && grep -qv installToolPassword $TYPO3_PATH_WEB/typo3conf/LocalConfiguration.php
- ./typo3cms configuration:set BE/installToolPassword blablupp && grep installToolPassword $TYPO3_PATH_WEB/typo3conf/LocalConfiguration.php | grep blablupp
- rm -f $TYPO3_PATH_WEB/typo3conf/PackageStates.php && ./typo3cms install:generatepackagestates && [ -f "$TYPO3_PATH_WEB/typo3conf/PackageStates.php" ]
- rm -f $TYPO3_PATH_WEB/typo3conf/PackageStates.php && ./typo3cms install:generatepackagestates --activate-default && [ -f "$TYPO3_PATH_WEB/typo3conf/PackageStates.php" ]
- rm $TYPO3_PATH_WEB/typo3temp/index.html && ./typo3cms install:fixfolderstructure && [ -f "$TYPO3_PATH_WEB/typo3temp/index.html" ]
- ./typo3cms extension:list
- ./typo3cms extension:list --raw | grep extbase
- ./typo3cms extension:list --active --raw | grep extbase
- ./typo3cms extension:list --inactive --raw | tr '\n' ' ' | grep -v extbase

after_script:
- >
Expand Down
22 changes: 16 additions & 6 deletions Classes/Command/ExtensionCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,25 @@ public function dumpAutoloadCommand()
}

/**
* List active extensions
* List extensions that are available in the system
*
* @param bool $raw True for a comma separated list of extension keys
* @return void
* @param bool $active Only show active extensions
* @param bool $inactive Only show inactive extensions
* @param bool $raw Enable machine readable output (just extension keys separated by line feed)
*/
public function listActiveCommand($raw = false)
public function listCommand($active = false, $inactive = false, $raw = false)
{
$extensionInformation = [];
foreach ($this->packageManager->getActivePackages() as $package) {
if (!$active || $inactive) {
$this->emitPackagesMayHaveChangedSignal();
$packages = $this->packageManager->getAvailablePackages();
} else {
$packages = $this->packageManager->getActivePackages();
}
foreach ($packages as $package) {
if ($inactive && $this->packageManager->isPackageActive($package->getPackageKey())) {
continue;
}
$metaData = $package->getPackageMetaData();
$extensionInformation[] = [
'package_key' => $package->getPackageKey(),
Expand All @@ -178,7 +188,7 @@ public function listActiveCommand($raw = false)
];
}
if ($raw) {
$this->outputLine('%s', [implode(',', array_column($extensionInformation, 'package_key'))]);
$this->outputLine('%s', [implode(PHP_EOL, array_column($extensionInformation, 'package_key'))]);
} else {
$this->output->outputTable(
$extensionInformation,
Expand Down
27 changes: 26 additions & 1 deletion Documentation/CommandReference/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Command Reference
in the binary directory specified in the root composer.json (by default ``vendor/bin``)


The following reference was automatically generated from code on 2016-10-15 14:34:35
The following reference was automatically generated from code on 2016-10-17 12:08:09


.. _`Command Reference: typo3_console`:
Expand Down Expand Up @@ -598,6 +598,31 @@ creating or updating this info properly during extension (de-)activation.



.. _`Command Reference: typo3_console extension:list`:

``extension:list``
******************

**List extensions that are available in the system**





Options
^^^^^^^

``--active``
Only show active extensions
``--inactive``
Only show inactive extensions
``--raw``
Enable machine readable output (just extension keys separated by line feed)





.. _`Command Reference: typo3_console extension:setup`:

``extension:setup``
Expand Down