Skip to content

Commit

Permalink
Merge pull request #43 from svenfinke/add-bash-autocompletion
Browse files Browse the repository at this point in the history
Add bash autocompletion command
  • Loading branch information
JanPietrzyk authored Jul 31, 2017
2 parents 4b25c38 + dac4501 commit 9371143
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,7 @@ You can add more commands to be executed in a chain, by comma separating the scr
> ./psh.phar unit,build #executes both scripts in order
```

### Bash Autocompletion

Bash autocompletion is only provided by [PSH-Global](https://github.com/shopwareLabs/psh-global). This will install a global script that fetches
the psh.phar file in your project and that will install the autocompletion for you.
8 changes: 8 additions & 0 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ public function run(array $inputArgs): int

$this->printHeader($config);
$scriptNames = $this->extractScriptNames($inputArgs);
if (count($scriptNames) > 0 && $scriptNames[0] === 'bash_autocompletion_dump') {
$scripts = $scriptFinder->getAllScripts();
$commands = array_map(function (Script $script) {
return $script->getName();
}, $scripts);
echo implode(' ', $commands);
return self::RESULT_SUCCESS;
}

try {
foreach ($scriptNames as $scriptName) {
Expand Down

0 comments on commit 9371143

Please sign in to comment.