adalessa/laravel.nvim

Passing flags when calling artisan commands from telescope

Closed this issue · 10 comments

Is there a way to pass flags when calling artisan commands from telescope, like for example ˇphp artisan make:model -rm` for resource and migration?

I've been thinking about this. currently I am working on a v2 branch with some improvements in the code base.
I have added to the commands the option skip_args as command option.
I think using that can be added a new property options that in case the user does not select to provide options use the set ones.

@dorkster100 I have implemented it in the branch v2 in case you want it to give it a shot.

@adalessa can you explain how I can pass flags to the php artisan make:model command (from telescope picker)?

@dorkster100 sure, here in the config I put it as example https://github.com/adalessa/laravel.nvim/blob/v2/lua/laravel/config/init.lua#L21 not sure if I will leave it for final configuration when releasing v2.
For context these options will be use here https://github.com/adalessa/laravel.nvim/blob/v2/lua/laravel/telescope/ui_run.lua#L90

Let me know if that works for your use case or we can discuss it further.

@adalessa this is cool, but would also be nice to have ability to pass flags at runtime, not only in the config. We can for example make additional picker action to ask for flags if you hit CTRL + Enter for example.

For flags during runtime you can use the existing <c-y> yeah I know is not documented and not configurable. I will have to update that in the docs and the code as well.
https://github.com/adalessa/laravel.nvim/blob/main/lua/telescope/_extensions/laravel.lua#L149 here is the code where is set.

I tried it, seems good enough for me, although we could maybe improve it by auto-completing or showing available flags (they are available).
In general update seems nice, i have not yet experienced all the changes, but i see many small things improved.

Instead of simply documenting this behavior, maybe we could try ad6ng it to the help menu that appears after clicking ?

Thanks for the feedback. I think it's a good idea, I didn't think about completition but they are supported. I will have to play with them to see how they behave, if not build around another type of interface.

Regarding the help yes, to add it to the telescope help I will check, also your comment give me the idea that should be added as vim documentation as well.

With v2 this was fixed now this is reported property with telescope help. Note here to solve it need to be an external function not anonymous.