diff --git a/bin/console b/bin/console index bf7fc02..75e248c 100755 --- a/bin/console +++ b/bin/console @@ -40,6 +40,20 @@ $longOpts = [ $options = getopt(short_options: $shortOpts, long_options: $longOpts, rest_index: $restIndex); if (array_key_exists(key: 'v', array: $options) || array_key_exists(key: 'version', array: $options)) { + $composerJson = json_decode(json: file_get_contents(filename: dirname(path: __DIR__) . '/composer.json'), associative: true); + $name = $composerJson['name']; + $decription = $composerJson['decription']; + $version = $composerJson['version']; + $build_number = $composerJson['build_number']; + $authorName = $composerJson['authors'][0]['name']; + $authorEmail = $composerJson['authors'][0]['email']; + + echo "Name: $name\n"; + echo "Description: $decription\n"; + echo "Version: $version\n"; + echo "Build Number: $build_number\n"; + echo "Author: $authorName ($authorEmail)\n"; + print("bindAPI version: $version" . PHP_EOL); exit(0); } diff --git a/composer.json b/composer.json index 5dc9f96..61d68bd 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "tracer/bindapi", + "name": "24unix/bindapi", "decription": "fo", "version": "2023.0.1", - "build_number": "320", + "build_number": "1", "authors": [ { "name": "Micha Espey", diff --git a/src/Controller/CLIController.php b/src/Controller/CLIController.php index dc74875..8c2a6ce 100644 --- a/src/Controller/CLIController.php +++ b/src/Controller/CLIController.php @@ -267,16 +267,15 @@ class CLIController function runCheckSetup(): void { if (!$this->domainController->checkPermissions(disableVerbose: false)) { - echo 'You need to setup the bindAPI first.' . PHP_EOL; - exit(1); + echo COLOR_RED . 'You need to setup the bindAPI first.' . COLOR_DEFAULT .PHP_EOL; } $self = $this->panelRepository->findSelf(); - $c = count($self); + $panelCount = count($self); - if ($c != 1) { - if ($c == 0) { + if ($panelCount != 1) { + if ($panelCount == 0) { echo 'No panel marked as this server.' . PHP_EOL; echo 'Use ' . COLOR_YELLOW . 'panels:update self=1 ' . COLOR_DEFAULT . 'to mark this panel.' . PHP_EOL; } else {