I've built a reasonably sized CLI app with everything split across different classes and namespaces in a logical way. However many components need to render output from within themselves. Which seems messy.To expand...The program copies content files and databases between servers. The main file kicks in, then loads other files that handle configuration, CLI arguments, environment loading etc, then dispatches commands to other systems that do some pre-flight tests, database copying, database integrity checks, database replacements, file copying, etc.Most of these systems have output during their operations, some use ASCII progress bars that need to be updated or otherwise output lines that need to be overwritten.Up until now I've had each system use a dependency injected CLI Output class that wraps a bunch of output functions. But it still seems messy to trigger output from so many different systems that should only be focussing on their work task, not output.I've experimented with creating another system that takes callbacks from all the others, then calculates and renders the output. So each subsystem is only doing the job it was assigned, but triggering callbacks with various useful information at key steps.This is nice, but also leads to more bloat.Is there any precedence on the best way to do this? Maybe a third way I haven't thought of?
Where to output from large CLI app
php;separation of concerns;cli