diff --git a/src/Commands/EnvironmentsCommand.php b/src/Commands/EnvironmentsCommand.php index 38be004..7c90a62 100644 --- a/src/Commands/EnvironmentsCommand.php +++ b/src/Commands/EnvironmentsCommand.php @@ -196,6 +196,21 @@ protected function renderEnvironmentInfo(EnvironmentResponse $environment, Serve $environmentTable->render(); } + /** + * Shows the branch an environment is currently on. + * + * @param string $uuid + * @param string $environment + * + * @command environment:branch + * @aliases env:branch,e:b + */ + public function environmentBranch(Environments $environmentsAdapter, $uuid, $environment) + { + $environment = $this->cloudapiService->getEnvironment($uuid, $environment); + $this->say($environment->vcs->path); + } + /** * Renames an environment. * diff --git a/tests/Commands/EnvironmentCommandTest.php b/tests/Commands/EnvironmentCommandTest.php index 2a781a1..d513462 100644 --- a/tests/Commands/EnvironmentCommandTest.php +++ b/tests/Commands/EnvironmentCommandTest.php @@ -92,6 +92,10 @@ public function environmentProvider() ['environment:info', 'devcloud:devcloud2', 'dev'], $getEnvironmentInfo . PHP_EOL ], + [ + ['environment:branch', 'devcloud:devcloud2', 'dev'], + '> master' . PHP_EOL + ], [ ['environment:rename', 'devcloud:devcloud2', 'dev', 'name'], '> Renaming Dev to name' . PHP_EOL