Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoids attempt to question when there is no answers available #33

Merged
merged 2 commits into from
Sep 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/Commands/Concerns/InteractsWithIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function askForSite($question)

$answers = collect($this->forge->sites($this->currentServer()->id));

abort_if($answers->isEmpty(), 1, 'This server does not have any sites.');

if (! is_null($name)) {
return optional($answers->where('name', $name)->first())->id ?: $name;
}
Expand All @@ -67,6 +69,8 @@ public function askForServer($question)

$answers = collect($this->forge->servers());

abort_if($answers->isEmpty(), 1, 'This account does not have any servers.');

if (! is_null($name)) {
return optional($answers->where('name', $name)->first())->id ?: $name;
}
Expand All @@ -88,6 +92,8 @@ public function askForDaemon($question)

$answers = collect($this->forge->daemons($this->currentServer()->id));

abort_if($answers->isEmpty(), 1, 'This server does not have any daemons.');

if (! is_null($command)) {
return optional($answers->where('command', $command)->first())->id ?: $command;
}
Expand Down