Skip to content

Commit

Permalink
✨ Add social builder
Browse files Browse the repository at this point in the history
  • Loading branch information
matyo91 committed Sep 8, 2024
1 parent b2e7d35 commit f6533df
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/Command/SocialBuilderCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

#[AsCommand(
name: 'app:social-builder',
description: 'Add a short description for your command',
)]
class SocialBuilderCommand extends Command
{
public function __construct()
{
parent::__construct();
}

protected function configure(): void
{
$this
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
;
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$arg1 = $input->getArgument('arg1');

if ($arg1) {
$io->note(sprintf('You passed an argument: %s', $arg1));
}

if ($input->getOption('option1')) {
// ...
}

$io->success('You have a new command! Now make it your own! Pass --help to see your options.');

return Command::SUCCESS;
}
}

0 comments on commit f6533df

Please sign in to comment.