Created
January 3, 2015 12:46
-
-
Save DuffleOne/659617c9fc24337d96e8 to your computer and use it in GitHub Desktop.
Example Symfony Console Command with CLImate
This file contains 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
#! /usr/bin/env php | |
<?php | |
require_once 'vendor/autoload.php'; | |
use Symfony\Component\Console\Application; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
use League\CLImate\CLImate; | |
$app = new Application('Duffleman Test', '1.0'); | |
$app->register('sayHelloTo') | |
->setDescription('Offer a greeting') | |
->addArgument('name', InputArgument::REQUIRED, 'Your name') | |
->setCode(function(InputInterface $input, OutputInterface $output) { | |
$cli = new CLImate; | |
$name = $input->getArgument('name'); | |
$output->writeln('Hello ' . $name); | |
$cli->red('Hello ' . $name); | |
}); | |
$app->run(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!