OleVik / grav-plugin-static-generator

Indexing and static generation of Page(s) for Grav.
MIT License
22 stars 1 forks source link

Fix error output for invalid target #2

Closed klonfish closed 4 years ago

klonfish commented 4 years ago

When passing an invalid target (or having one set in the configuration) to the static page generation command, the output of the error itself generates a PHP fatal error since the error method is not defined for the output object.

This PR just replaces this call with writeln as in the corresponding line in GenerateStaticIndexCommand.php.

However, since the code for parsing the target is now completely identical in both files, it would probably be best to extract it to a function. But, as a large part of it outputs to the console, I'm not quite sure where to place it or to what degree that refactoring would make sense.

OleVik commented 4 years ago

I am currently refactoring for v2.0.0, but you're quite right - both files are purely components for operating with Grav's CLI.