bpocallaghan / generators

Laravel File Generators with config and publishable stubs
MIT License
117 stars 19 forks source link

Some feature request and speaking of generate::request #19

Open Stevemoretz opened 4 years ago

Stevemoretz commented 4 years ago

Hi, I was thinking about what you've done here.You know that message that says

.somepath/some/test.bladee.php Was generated At the end.I guess it could be great if in config/generator.php

A function could be defined to handle that message.

You may think what kind of stupid feature is that :D

But the purpose is that you can do a few stuff here to open the files that were generated in the ide.

Since I think it isn't such a great idea to handle all these ide opening stuff yourself because I see you're working alone on this, I guess that would be a lot better so you can do a few ones and let the rest of it to the other ide users.

There are two possible ways to open a file in ide from php.

Either output a link like idea://blahblah... Which is a link that when opens gets you there. Or some ideas again like intellij suppert a command for opening files in terminal so a exec() in php could do that or again intellij can open files in this link too : file:///path.blade.php

So you get the point,that could let the users do any of these ways in their ides which I think is a great idea.


The other thing you said generate::request

I don't know what that is but in a few days I'm making something which basically makes adding somethings like routes in web.php automated from php well essentially I'm doing it for some other reason, but if that's something like what you need, I'll provide the code to what I've done when it's done and also can help you adapt it for your own use case.It's just a little playing with regex. But I guess you won't need my help. Anyways it never hurts to hear somebody offers some help.

bpocallaghan commented 4 years ago

Hi @Stevemoretz

Can go to file after file was generated: This is actually a very cool idea. Question, what IDE are you using? I am working on Windows and mostly use ConEmu, however I recently switched to VS Code and you can actually alt + click on the path and it will open that file for you...

Append code to routes: Also very cool, as when you generate the resource, I actually do not append your routes file. So eager to see / find out more what you are busy doing.

Thanks for the feedback / ideas and suggestions. Yeah, always nice to talk to others as I mostly work alone on projects.

Stevemoretz commented 4 years ago

Hi again. Yeah me too actually I work alone always.

I'm using intellij idea and it has the same feature as your VS Code but also has other features to open files too like directly from terminal but I think most of the ides support file:///path/scheme Even if they don't they still can access and change that.

1.Get the path 2.Check if config/generate.php has an entry like handlePath => something 3.check if something is a function 4.send path as argument to the function

2.5 if the entry didn't exist default to file:///path...

That will take care of it.

About the adding stuff to the already created files it's actually pretty simple only needs some simple regex and working with files. I'll send the example I mentioned in a few days. Not because it takes a few days :D it takes a couple of minutes but I can't work on that yet cause I'm busy.

It's nice talking to you.