Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Shell_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use EE\Model\Site;
use function EE\Site\Utils\auto_site_name;
use function EE\Utils\get_flag_value;

/**
* Brings up a shell to run wp-cli, composer etc.
Expand Down Expand Up @@ -35,6 +36,9 @@ class Shell_Command extends EE_Command {
* [--command=<command>]
* : Command to non-interactively run in the shell.
*
* [--skip-tty]
* : Skips tty allocation.
*
* ## EXAMPLES
*
* # Open shell for site
Expand Down Expand Up @@ -75,8 +79,11 @@ public function __invoke( $args, $assoc_args ) {

$shell = ( 'mailhog' === $service ) ? 'sh' : 'bash';
$command = \EE\Utils\get_flag_value( $assoc_args, 'command' );

$tty = get_flag_value( $assoc_args, 'skip-tty' ) ? '-T' : '';

if ( $command ) {
EE::exec( "docker-compose exec $user_string $service $shell -c \"$command\"", true, true );
EE::exec( "docker-compose exec $tty $user_string $service $shell -c \"$command\"", true, true );
} else {
$this->run( "docker-compose exec $user_string $service $shell" );
}
Expand Down