PSR12 code standard.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@ -1,45 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
|
||||
#[AsCommand(
|
||||
name: 'show',
|
||||
description: 'Show all backup entries.',
|
||||
hidden: false,
|
||||
)]
|
||||
class CommandShow extends Command
|
||||
{
|
||||
static $defaultName = "show";
|
||||
static $defaultDescription = "Show all backup entries";
|
||||
public static $defaultName = "show";
|
||||
public static $defaultDescription = "Show all backup entries";
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->addArgument('config', InputArgument::OPTIONAL, 'Configuration file', "config.yml");
|
||||
$this->addArgument(
|
||||
'config',
|
||||
InputArgument::OPTIONAL,
|
||||
'Configuration file',
|
||||
"config.yml"
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->title('List backup entities');
|
||||
$sio = new SymfonyStyle($input, $output);
|
||||
$sio->title('List backup entities');
|
||||
|
||||
try {
|
||||
$app = new App($input->getArgument('config'));
|
||||
}
|
||||
catch (\Throwable $e) {
|
||||
$io->error('Unable to parse the YAML string: '. $e->getMessage());
|
||||
} catch (\Throwable $e) {
|
||||
$sio->error('Configuration error: ' . $e->getMessage());
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
$io->table(['Description', 'Source', 'Destination'], $app->getConfig()['backup']);
|
||||
$sio->table(
|
||||
['Description', 'Source', 'Destination'],
|
||||
$app->getConfig()['backup']
|
||||
);
|
||||
|
||||
$io->success("Done");
|
||||
$sio->success("Done");
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user