From cc3bbca0ee26f455fe93d0d887f7f279da1a9bae Mon Sep 17 00:00:00 2001 From: Adam Malone Date: Sun, 18 Oct 2020 11:39:18 +1100 Subject: [PATCH] Fixes #97 Adds environment:branch command. --- src/Commands/EnvironmentsCommand.php | 15 +++++++++++++++ tests/Commands/EnvironmentCommandTest.php | 4 ++++ 2 files changed, 19 insertions(+) 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