nunomaduro / termwind

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
MIT License
2.29k stars 78 forks source link

feat: add line and link aliases #33

Closed ju5t closed 3 years ago

ju5t commented 3 years ago

This makes sure that the CLI purists (including myself) can use the old line method. The recently added a() aliases to link(). I know this is a personal opinion, but I think the package can support both uses.

I was a bit unsure if I should test this. The other functions didn't seem to have tests either. I haven't jumped on the PEST train either (yet) but the docs are really clear, so it should be doable to make some tests for it if needed.

If you disagree with this feature, no worries. As a user you can always alias it yourself, if you want.

edit: I didn't change the underlying class methods, but it might be worthwhile aliasing them too? Perhaps in the future.

nunomaduro commented 3 years ago

@xiCO2k Either we use the HTML API or we use other. We need to decide on that.

xiCO2k commented 3 years ago

I think the HTML api would be the better option.

ju5t commented 3 years ago

I think it is a matter of preference. For me, using link and line are more intuitive than html tags and closer to its origin of the command line, and are, at least for me, easier to remember. I personally think html-tags have no place on the command line.

E.g. a span is an inline-block and never has a line break, but on the command line a line break is often implied. So, if it has to be html, a div makes more sense. But as a div implies a container, often containing multiple elements, it can't be a div either. Eventually, a line is all that remains :)

Either way, I was hoping to find a middle ground by adding aliases.

My perfect world would probably be class-based elements, instead of method based. I realise this might be way beyond the point of deciding whether or not you should use html tags as a primary API. But it would probably give users a clean way of building their own heading, alert, block or any other element.

ju5t commented 3 years ago

@nunomaduro I think it's probably better to close this PR as:

  1. Nobody responds :)
  2. I'm probably the only person who thinks the concept of html tags in a CLI application isn't right.

I understand the need to settle on one API, but in that case, this package is probably not for me (which is totally fine!). The idea is still cool and who knows, perhaps one day I look back and think that html on the command line is the right API :)

Edit: forgot to say, thanks for the awesome work you're doing though, I am a huge, huge fan of Laravel Zero, Larastan and when we're ready to move on to Pest, probably that too :)