deployer run task code example
Example 1: Deployer custom Options
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
argument('stage', InputArgument::OPTIONAL, 'Run tasks only on this host or stage.');
option('tag', null, InputOption::VALUE_OPTIONAL, 'Tag to deploy.');
Example 2: Deployer custom Options
task('foo:bar', function() {
// For arguments
$stage = null;
if (input()->hasArgument('stage')) {
$stage = input()->getArgument('stage');
}
// For option
$tag = null;
if (input()->hasOption('tag')) {
$tag = input()->getOption('tag');
}
});