1

I've a little problem with my console. When I use choice method from Laravel Console, the output totally breaks down. I wanted to google this but I can't find any solution. It's really annoying.

Anyone know how to fix this?

I'm using Git Bash provided by Git for Windows. That Git bash is an emultion of unix console and it makes me able to use unix like commands. I don't want to stop using this.

Here is the console output

Give your group a name:

Something

Give your group a description (blank for skip): >

Do you want to assign scopes to your new group? (y/n):

y

Select existing scope name: [0] Random [1] Exit (It's not a scope)

0 0?[K

?[32mSelect existing scope name?[39m: [?[33m0?[39m] Random
[?[33m1?[39m] Exit (It's not a scope) >

And the php code as below.

$name = $this->ask('Give your group a name');

$description = $this->ask('Give your group a description (blank for skip)');

$groups = app()->make(ScopeGroupRepository::class);

/** @var ScopeGroup $group */
$group = $groups->perform(new Create($name, $description));

$willCreateScopes = $this->answerToBoolean(
    $this->ask('Do you want to assign scopes to your new group? (y/n)')
);

if(!$willCreateScopes) {
    return $this->displayCreatedGroupInfo($group);
}

$scopes = app()->make(ScopeRepository::class);

/** @var Collection $unassigned */
$unassigned = $scopes->perform((new ShowAllUnassignedToGroup())->setGroupId($group->id));

if($willCreateScopes) {
    do {
        $scopes = $unassigned->map(function (Scope $scope){
            return $scope->id;
        })->toArray();

        array_push($scopes, 'Exit (It\'s not a scope)');
        // Here it breaks down
        $selected = $this->choice('Select existing scope name', $scopes);

    } while($selected !== 'Exit (It\'s not a scope)');
}

Thanks for help.

deefour
  • 34,974
  • 7
  • 97
  • 90
Maciej Król
  • 382
  • 1
  • 8
  • https://stackoverflow.com/questions/27580668/how-to-correctly-enable-ansi-colors-in-conemu-git-bash/48206769#48206769 – deefour Sep 26 '19 at 14:24
  • So I should install ConEmu to make it work properly? – Maciej Król Sep 26 '19 at 14:38
  • I honestly have no idea. I came here because some keeps tagging the question with php, laravel, and git, and this has nothing to do with any of those things. It's a windows + GitBash ANSI color issue. – deefour Sep 26 '19 at 16:06

0 Answers0