getkirby / cli

Kirby Command Line Interface
MIT License
51 stars 5 forks source link

New `debug` mode #64

Closed afbora closed 6 months ago

afbora commented 6 months ago

I think we need debug mode. Currently if error occured, exception details are visible in console.

For ex, we can wrap try-catch block. https://github.com/getkirby/cli/blob/main/src/CLI/CLI.php#L539

try {
  $command['command']($this);
} catch (Exception $e) {
  $this->error($e->getMessage());
}

If debug mode enabled, should out error message, instead exception details. But I have no idea about enabling debug mode in CLI. Maybe a global argument? kirby clear:cache --debug, not sure.

bastianallgeier commented 6 months ago

I agree. I think the global flag would be nice indeed.