Skip to content

Commit

Permalink
Fixed branch selection in site delete-branch, removed live and test f…
Browse files Browse the repository at this point in the history
…rom the list
  • Loading branch information
Sara McCutcheon committed Aug 10, 2016
1 parent fd3e9e6 commit 35316e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project starting with the 0.6.0 release will be docu

### Fixed
- Fixed type error in `site hostnames lookup` which appears when there are no results. (#1139)
- Fixed branch selection in `site delete-branch`. (#1143)

### Removed
- Removed `sites import` command. Please create new sites with `sites create` and then import via `site import` instead. (#1132)
Expand Down
12 changes: 8 additions & 4 deletions php/Terminus/Commands/SiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,16 @@ public function delete($args, $assoc_args) {
*/
public function deleteBranch($args, $assoc_args) {
$site = $this->sites->get(
$this->input()->siteName(['args' => $assoc_args])
$this->input()->siteName(['args' => $assoc_args,])
);
$branches = array_diff(
(array)$site->getTips(),
['master', 'live', 'test',]
);
$branches = array_diff((array)$site->getTips(), ['master']);
if (empty($branches)) {
$this->failure(
'The site {site} has no branches which may be deleted.',
['site' => $site->get('name')]
['site' => $site->get('name'),]
);
}
$branch = $this->input()->menu(
Expand All @@ -573,14 +576,15 @@ public function deleteBranch($args, $assoc_args) {
'key' => 'branch',
'label' => 'Select the branch to delete',
'choices' => $branches,
'return_value' => true,
]
);

$message = 'Are you sure you want to delete the "%s" branch from %s?';
$this->input()->confirm(
[
'message' => $message,
'context' => [$branch, $site->get('name')],
'context' => [$branch, $site->get('name'),],
]
);

Expand Down

0 comments on commit 35316e7

Please sign in to comment.