Created
          July 2, 2014 16:29 
        
      - 
      
- 
        Save ngyuki/82e7a553e2d78237bc87 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use Symfony\Component\Console\Application; | |
| use Symfony\Component\Console\Command\Command; | |
| use Symfony\Component\Console\Input\InputOption; | |
| use Symfony\Component\Console\Input\InputInterface; | |
| use Symfony\Component\Console\Output\OutputInterface; | |
| $commands = []; | |
| $commands[] = (new Command('hello')) | |
| ->setDescription("Hello") | |
| ->addOption("name", "N", InputOption::VALUE_OPTIONAL, "Name", "unknown") | |
| ->setCode(function (InputInterface $input, OutputInterface $output) { | |
| $name = $input->getOption('name'); | |
| $output->writeln("hello <info>$name</info>"); | |
| }) | |
| ; | |
| $app = new Application(); | |
| $app->addCommands($commands); | |
| $app->run(); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment