Skip to content

Commit

Permalink
Fixes #97 Adds environment:branch command.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Oct 18, 2020
1 parent 12ca1d8 commit cc3bbca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Commands/EnvironmentsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 4 additions & 0 deletions tests/Commands/EnvironmentCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc3bbca

Please sign in to comment.