loadConfiguration(__DIR__ . "/config.php"); if (method_exists($changelogs_commands, $argv[1] ?? null)) { $changelogs_commands->{$argv[1]}(array_slice($argv, 2)); } else { $ref_class = new ReflectionClass("Studioamica\ChangelogsWriter\Core\ChangelogCommands"); $docs = ""; foreach ($ref_class->getMethods() as $method) { if ($method != "__construct") { $comment = $ref_class->getMethod($method->name)->getDocComment(); if (strpos($comment, "Command example:\n") !== false) { $comment = str_replace("Command example", "\033[36m{$method->name}\033[0m", $comment); $comment = str_replace("/**\n", "", $comment); $comment = str_replace(" */", " -----", $comment); $comment = str_replace(" *", "", $comment); $comment = str_replace("changelog.php /path/to/config.php ", "changelog ",$comment); echo $comment . "\n"; } } } }