codestudiohq / laravel-totem

Manage Your Laravel Schedule From A Web Dashboard
MIT License
1.79k stars 224 forks source link

[BUG] overriding multiples arguments; #60

Closed JeanCarloLeal closed 6 years ago

JeanCarloLeal commented 6 years ago

Creating at new task: in the field "PARAMETERS (OPTIONAL)" I insert the following information for a custom command that can accept multiple arguments: "seaport=15 typetraffic=05" When i click Execute (to force execution) it works, because it don't use the console. However, when using the console (Laravel's schedule), it errors. I took the liberty to debug the code and found a problem in the file Task.php, method compileParameters. The problem happens because when running on console it doesn't pass named parameters, and in the mentioned method it will override the first parameter with the second as both will have the key 0. Following is a Print of a fix.

Please inform me if there is another solution.

roshangautam commented 6 years ago

@qschmick would you like to take a look at this. I would appreciate it.

qschmick commented 6 years ago

@roshangautam Sure thing.

@JeanCarloLeal Can you add the -- before each of your arguments. E.g. --seaport=15?

JeanCarloLeal commented 6 years ago

@qschmick I have not tested creating my command with --options, I believe this works. But using multiple arguments we've found the problem quoted.

qschmick commented 6 years ago

@JeanCarloLeal thanks for the follow up. For clarification, you are passing the values seaport=15 as the argument to your command or are you declaring seaport => 15? Would you be able to share your commands signature (obviously redacted as needed)? Thank you in advance for the help.

JeanCarloLeal commented 6 years ago
protected function getArguments()
    {
        return [
            ['seaport', InputArgument::REQUIRED, 'Código com os portos separados por virgula.'],
            ['typeTraffic', InputArgument::REQUIRED, 'Tipo de trafico separado por virgula.'],
            ['limit', InputArgument::OPTIONAL, 'Limit default 5000'],
            ['date', InputArgument::OPTIONAL, 'No formato \'Y-m-d\', Default -1'],
        ];
    }

In totem Usage: seaport=15 typeTraffic=05 Console Usage: php artisan ce:generate 15 05

qschmick commented 6 years ago

@JeanCarloLeal Just merged in a fix for this issue.

JeanCarloLeal commented 6 years ago

Ty

JeanCarloLeal commented 6 years ago

@qschmick I was updating my project and had a surprise, I'm using v2.1.

And your fix was for v2.0, can you check?

composer require studio/laravel-totem 
Using version ^2.1 for studio/laravel-totem
roshangautam commented 6 years ago

Its probably because its not been tagged yet.

qschmick commented 6 years ago

@JeanCarloLeal Just tagged v2.2