first commit
This commit is contained in:
29
vendor/webman/console/src/Commands/VersionCommand.php
vendored
Normal file
29
vendor/webman/console/src/Commands/VersionCommand.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Webman\Console\Commands;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class VersionCommand extends Command
|
||||
{
|
||||
protected static $defaultName = 'version';
|
||||
protected static $defaultDescription = 'Show webman version';
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$installed_file = base_path() . '/vendor/composer/installed.php';
|
||||
if (is_file($installed_file)) {
|
||||
$version_info = include $installed_file;
|
||||
}
|
||||
$webman_framework_version = $version_info['versions']['workerman/webman-framework']['pretty_version'] ?? '';
|
||||
$output->writeln("Webman-framework $webman_framework_version");
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user