Skip to content

Commit ec830aa

Browse files
committed
fix: use the project id when given as an argument
1 parent 85112ae commit ec830aa

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Command/AbstractCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,13 @@ protected function determineProject(string $question, InputInterface $input, Out
170170

171171
$projectIdOrName = $this->getStringArgument($input, 'project');
172172

173-
if (empty($projectIdOrName)) {
173+
if (empty($projectIdOrName) && $this->projectConfiguration->exists()) {
174+
$projectIdOrName = $this->projectConfiguration->getProjectId();
175+
} elseif (empty($projectIdOrName)) {
174176
$projectIdOrName = $output->choiceWithId($question, $projects);
175-
} elseif (1 < $projects->where('name', $projectIdOrName)->count()) {
177+
}
178+
179+
if (1 < $projects->where('name', $projectIdOrName)->count()) {
176180
throw new RuntimeException(sprintf('Unable to select a project because more than one project has the name "%s"', $projectIdOrName));
177181
}
178182

src/Command/Project/DeleteProjectCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ protected function configure()
5151
*/
5252
protected function perform(InputInterface $input, OutputInterface $output)
5353
{
54-
$projectId = $this->projectConfiguration->exists() ? $this->projectConfiguration->getProjectId() : null;
55-
56-
if (null === $projectId) {
57-
$projectId = $this->determineProject('Which project would you like to delete', $input, $output);
58-
}
59-
54+
$projectId = $this->determineProject('Which project would you like to delete', $input, $output);
6055
$project = $this->apiClient->getProject($projectId);
6156

6257
if (!$output->confirm(sprintf('Are you sure you want to delete the <comment>%s</comment> project?', $project['name']), false)) {

0 commit comments

Comments
 (0)