Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Set up bash completion on the box command
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Rombauts committed Nov 5, 2015
1 parent abdc926 commit 43c589e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To view the diff between two versions, go to https://github.com/joomlatools/joom
* Fixed - Consolidate the PHP ini files into a single custom.ini file
* Improved - Automatically change directory to /var/www when logging in via `vagrant ssh` or web terminal
* Improved - Added /terminal, /mailcatcher and /filebrowser aliases
* Improved - Added bash autocompletion to the `box` command

* 1.3.1 (2015-09-03)
* Added - Support for PHP7
Expand Down
3 changes: 3 additions & 0 deletions puppet/modules/box/files/scripts/box
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $autoload = __DIR__.'/vendor/autoload.php';
require_once $autoload;

use Symfony\Component\Console\Application;
use \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand;

spl_autoload_register(function($className) {
$className = ltrim($className, '\\');
Expand All @@ -24,6 +25,8 @@ spl_autoload_register(function($className) {

$application = new Application('Joomlatools Box', '0.1');

$application->add(new CompletionCommand());

$application->add(new Command\Apc\Enable());
$application->add(new Command\Apc\Disable());
$application->add(new Command\Apc\Clear());
Expand Down
9 changes: 8 additions & 1 deletion puppet/modules/box/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

exec { 'fetch-box-dependencies':
command => 'composer require symfony/console:2.4.* --no-interaction',
command => 'composer require symfony/console:2.7.* stecman/symfony-console-completion --no-interaction',
cwd => '/home/vagrant/box',
unless => '[ -d /home/vagrant/box/vendor/symfony ]',
path => '/usr/bin',
Expand All @@ -26,4 +26,11 @@
unless => 'grep ":/home/vagrant/box" /home/vagrant/.bash_profile',
require => Exec['make-box-executable']
}

file_line { 'register-box-autocompletion':
path => '/home/vagrant/.bash_profile',
line => 'source <(/home/vagrant/box/box _completion --generate-hook --program=box)',
require => File['/home/vagrant/.bash_profile']
}

}

0 comments on commit 43c589e

Please sign in to comment.