Add the docker-composer ps command.

This commit is contained in:
Travis Tomka
2018-04-28 12:33:19 -06:00
parent 2800a55776
commit 8ff8ed66bf
3 changed files with 68 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ composer require --dev droath/robo-docker-compose
The following commands have been implemented:
- docker-compose up
- docker-compose ps
- docker-compose pull
- docker-compose exec
- docker-compose down

59
src/Task/Ps.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
namespace Droath\RoboDockerCompose\Task;
use Droath\RoboDockerCompose\DockerServicesTrait;
/**
* Define the docker composer ps command.
*/
class Ps extends Base
{
use DockerServicesTrait;
/**
* {@inheritdoc}
*/
protected $action = 'ps';
/**
* Only display IDs.
*
* @return $this
*/
public function quiet()
{
$this->option('quiet');
return $this;
}
/**
* Display services.
*
* @return $this
*/
public function services()
{
$this->option('services');
return $this;
}
/**
* Filter services by a property.
*
* @param string $key
* The filter property key.
* @param string $value
* The filter property value.
*
* @return $this
*/
public function filter($key, $value)
{
$this->option('filter', "{$key}={$value}");
return $this;
}
}

View File

@@ -15,6 +15,14 @@ trait loadTasks
return $this->task(Up::class, $pathToDockerCompose);
}
/**
* Docker compose ps task.
*/
protected function taskDockerComposePs($pathToDockerCompose = null)
{
return $this->task(Ps::class, $pathToDockerCompose);
}
/**
* Docker compose down task.
*/