|
2 | 2 |
|
3 | 3 | namespace Bref\Cli\Commands; |
4 | 4 |
|
5 | | -use Amp\ByteStream\BufferException; |
6 | | -use Amp\Process\Process; |
7 | | -use Amp\Process\ProcessException; |
8 | 5 | use Bref\Cli\BrefCloudClient; |
9 | 6 | use Bref\Cli\Cli\IO; |
10 | 7 | use Bref\Cli\Cli\Styles; |
11 | | -use Bref\Cli\Components\ServerlessFramework; |
12 | | -use Bref\Cli\Config; |
13 | | -use Exception; |
14 | | -use Symfony\Component\Console\Command\Command; |
15 | 8 | use Symfony\Component\Console\Input\InputInterface; |
16 | | -use Symfony\Component\Console\Input\InputOption; |
17 | 9 | use Symfony\Component\Console\Output\OutputInterface; |
18 | | -use Symfony\Component\Console\Question\ChoiceQuestion; |
19 | | -use Symfony\Component\HttpClient\HttpClient; |
20 | | -use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; |
21 | | -use ZipArchive; |
22 | | -use function Amp\ByteStream\buffer; |
23 | | -use function Amp\delay; |
24 | 10 |
|
25 | | -class Info extends Command |
| 11 | +class Info extends ApplicationCommand |
26 | 12 | { |
27 | 13 | protected function configure(): void |
28 | 14 | { |
29 | 15 | $this |
30 | 16 | ->setName('info') |
31 | | - ->setDescription('Show information about the application') |
32 | | - ->addOption('env', 'e', InputOption::VALUE_REQUIRED, 'The environment', 'dev') |
33 | | - ->addOption('config', 'c', InputOption::VALUE_REQUIRED, 'The location of the configuration file to use') |
34 | | - ->addOption('team', null, InputOption::VALUE_REQUIRED, 'Override the team'); |
| 17 | + ->setDescription('Show information about the application'); |
| 18 | + parent::configure(); |
35 | 19 | } |
36 | 20 |
|
37 | 21 | protected function execute(InputInterface $input, OutputInterface $output): int |
38 | 22 | { |
39 | | - /** @var string $environment */ |
40 | | - $environment = $input->getOption('env'); |
41 | | - /** @var string|null $configFileName */ |
42 | | - $configFileName = $input->getOption('config'); |
43 | | - $config = Config::loadConfig($configFileName, $environment, $input->getOption('team')); |
44 | | - $appName = $config['name']; |
| 23 | + [ |
| 24 | + 'appName' => $appName, |
| 25 | + 'environmentName' => $environmentName, |
| 26 | + 'config' => $config, |
| 27 | + ] = $this->parseStandardOptions($input); |
| 28 | + |
45 | 29 | IO::writeln([ |
46 | | - sprintf("%s %s / %s", Styles::brefLogo(), Styles::bold($appName), Styles::bold($environment)), |
| 30 | + sprintf("%s %s / %s", Styles::brefLogo(), Styles::bold($appName), Styles::bold($environmentName)), |
47 | 31 | '', |
48 | 32 | ]); |
49 | 33 |
|
50 | 34 | $brefCloud = new BrefCloudClient; |
51 | | - $environment = $brefCloud->getEnvironment($config['team'], $appName, $environment); |
| 35 | + $environment = $brefCloud->getEnvironment($config['team'], $appName, $environmentName); |
52 | 36 | $environmentLink = $brefCloud->url . '/environment/' . $environment['id']; |
53 | 37 | IO::writeln([ |
54 | 38 | "<href=$environmentLink>" . Styles::gray($environmentLink) . '</>', |
|
0 commit comments