stecman / symfony-console-completion

Automatic tab-key completion for Symfony console application options, arguments and parameters
MIT License
420 stars 26 forks source link

Separate shell hook templates from PHP code #50

Open stecman opened 9 years ago

stecman commented 9 years ago

Currently the templates for shell hooks live in PHP code as a static array of nowdoc strings (HookFactory::$hooks). At runtime these templates are populated using a str_replace call.

In the interest of keeping this part of the code maintainable, these templates should really be extracted from the PHP code and rendered with a more common templating system (Twig would be my choice).

aik099 commented 9 years ago

:-1: , because this would force any project using this library also have Twig (or similar) as a Composer dependency just to generate hooks.

If array with hook content doesn't sound right, then we can just move out each hook template into separate sh/zsh file in say bin sub-folder. Then we do file_get_contents and replace what's needed.

stecman commented 8 years ago

I kind of agree, though I'm sure there are some light-weight templating libraries that mitigate the large dependency issue (if it even is an issue?). The scripts should definitely be extracted to separate files, so we'll go with that for now - thanks.