Executes the current command.

@param InputInterface  $input  An InputInterface instance
@param OutputInterface $output An OutputInterface instance

@return null|int null or 0 if everything went fine, or an error code
16468
protected function execute(InputInterface $input, OutputInterface $output)
    {

        $listType = $input->getArgument('option');

        switch ($listType) {
            case "help":

                $help = [
                    '<info>',
                    '*******************************************************',
                    '* typo3 alias:show                shows help          *',
                    '* typo3 show:aliases this         shows current alias *',
                    '* typo3 show:aliases help         shows help          *',
                    '*******************************************************',
                    '</info>',
                ];

                $output->writeln($help);

                break;
            case "this":
                $contents = Yaml\Yaml::parse(file_get_contents($this->filename));

                foreach ($contents as $key => $value ){
                    if($value["path"] == PATH_site){
                        $output->writeln('<info>You are here: </info><question>'.$key.'</question>');
                    }

                }


                break;
            default:

                $output->writeln("Type 'show:aliases help' to find out more commands.");

                $output->writeln('Reading existing alias file');
                $contents = Yaml\Yaml::parse(file_get_contents($this->filename));

                $aliasesOutput = array();

                foreach ($contents as $key => $value ){
                    $aliasesOutput[] = '<question>'.$key.':</question>';
                    foreach ($value as $key2 => $value2){
                        $aliasesOutput[] = '   <info>'.$key2.': </info><comment>'.$value2.'</comment>';
                    }

                }


                $output->writeln($aliasesOutput);
                break;
        }

        return 0;

    }
370565
public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        $input  = $input ?: new ArgvInput();
        $output = $output ?: new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, null, $this->formatter());

        return parent::run($input, $output);
    }
642598
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->modx = $this->console->loadMODX();
        $this->modx->cacheManager->refresh();
        $output->writeln('### Cache has been refreshed(cleared) ###');
    }
915365
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $config = $this->parameters;
        $recursive = $input->getOption('recursive');
        $machine = $input->getOption('machine') ? $config->get('dotfiles.machine_name') : 'defaults';
        $backupDir = $config->get('dotfiles.backup_dir')."/src/$machine/home";
        $sourcePath = $input->getArgument('path');

        // detect source path
        $originPath = $this->detectPath($sourcePath);
        $relativePath = Toolkit::getRelativePath($originPath);
        if (0 === strpos($relativePath, '.')) {
            $relativePath = substr($relativePath, 1);
        }
        $relativePath = str_replace('.'.$sourcePath, $sourcePath, $relativePath);
        $targetPath = $backupDir.'/'.$relativePath;

        Toolkit::ensureDir($backupDir);

        $basename = basename($sourcePath);
        if (0 === strpos($basename, '.')) {
            $targetPath = str_replace('.'.$sourcePath, $basename, $targetPath);
        }

        if (is_dir($originPath)) {
            $this->doAddDir($originPath, $targetPath, $recursive);
        } else {
            $this->doAddFile($originPath, $targetPath);
        }
    }
496129
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $created = $this->scaffold(
            'ajax',
            [
                'CLASSNAME' => $input->getArgument('name'),
            ],
            [
                'ACTION' => $input->getOption('action'),
            ]
        );

        if ($created === true) {
            $output->writeln("<info>{$input->getArgument('name')} was created successfully</info>");
        } else {
            $output->writeln("<error>{$input->getArgument('name')} could not be created</error>");
        }
    }
391077
protected function execute(InputInterface $input, OutputInterface $output)
    {
		$this->input = $input;
		$this->output = $output;
		$this->force = $input->getOption('force');
		
		$helper = $this->getHelper('question');
		
        $userQuestion = new Question('User (root): ', 'root');
		
        $passwordQuestion = new Question('Password (): ', '');
		$passwordQuestion->setHidden(true);
		$passwordQuestion->setHiddenFallback(false);

        $hostQuestion = new Question('Host (localhost): ', 'localhost');
        $driverQuestion = new Question('Driver (pdo_mysql): ', 'pdo_mysql');
		
		$user = $helper->ask($input, $output, $userQuestion);
		$password = $helper->ask($input, $output, $passwordQuestion);
		$host = $helper->ask($input, $output, $hostQuestion);
		$driver = $helper->ask($input, $output, $driverQuestion);
		
		$connectionParams = array(
			'user' => $user,
			'password' => $password,
			'host' => $host,
			'driver' => $driver
		);
		
		try {
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
			
			$databases = $sm->listDatabases();
			
			$question = new ChoiceQuestion(
				'Database',
				$databases,
				0
			);
			$question->setErrorMessage('Selected database is not valid');

			$dbName = $helper->ask($input, $output, $question);
			$output->writeln('Chosen database: ' . $dbName);
			
			//Add the dbname property
			$connectionParams['dbname'] = $dbName;
			
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
		
			$tables = $sm->listTables();
			
			$this->loadConfiguration();
			
			$progress = new ProgressBar($output, count($tables));
			$progress->start();
			
			foreach ($tables as $table) {
				//$output->writeln($table->getName() . " columns:\n\n");
					
				//Columns
				/*
				foreach ($table->getColumns() as $column) {
					//$output->writeln(' - ' . $column->getName() . ': ' . $column->getType() . "\n");
				}
				*/
					
				//Foreign keys
				$name = $table->getName();
				$table = $sm->listTableDetails($name);
				//$foreignKeys = $table->getForeignKeys();
				//$output->writeln("Foreign keys (" . count($foreignKeys) . ")");
				/*
				foreach ($foreignKeys as $foreignKey) {
					//$output->writeln("\n");
					$foreignColumns = $foreignKey->getForeignColumns();
					$localColumns = $foreignKey->getLocalColumns();
					foreach($foreignColumns as $key => $foreignColumn){
						//$output->writeln($foreignKey->getLocalTableName() . "." . $localColumns[$key] . " <=> " . $foreignKey->getForeignTableName() . "." . $foreignColumn . "\n");
					}
				}
				*/
		
				$primaryKeys = $table->getPrimaryKeyColumns();
				//$output->writeln("Primary keys (" . count($primaryKeys) . ")");
				/*
				foreach ($primaryKeys as $primaryKey) {
					//$output->writeln("\n" . $primaryKey);
				}
				*/
				
				//$output->writeln("\n\n");
				$this->generateCode($name, reset($primaryKeys));
				
				$progress->advance();
			}
			
			$progress->finish();
		} catch(\Exception $ex){
			$output->writeln('Generator has found the current exception: ');
			$output->writeln($ex->getMessage());
		}
    }
1240084
public function run(InputInterface $input = null, OutputInterface $output = null)
	{
		try
		{
			parent::run($input, $output);
		}
		catch (\Exception $e)
		{
			if (null === $output) {
				$output = new ConsoleOutput();
			}
			$message = array(
				$this->getLongVersion(),
				'',
				$e->getMessage(),
				''
			);
			$output->writeln($message);
		}
	}
983759
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setIo($input, $output);

        $repo = $this->prepareRepository();

        $this->rebuild();

        $this->deployWithGit($repo);
    }
594086
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        try {
            return $this->fire();
        } catch (DomainException $e) {
            return 1;
        } catch (Exception $e) {
            $this->error($e->getMessage());
            $this->error('Abort!');
        }

        return;
    }
534591
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getApplication()->getContainer();
        $container->configure();

        $classname = $input->getArgument('class');
        $method = $input->getArgument('method');

        if (!$this->confirm($input, $classname, $method)) {
            return;
        }

        $resource = $container->get('locator.resource_manager')->createResource($classname);

        $container->get('code_generator')->generate($resource, 'specification_method', [
            'method' => $method,
            'type' => $this->confirmMethodType($input, $output),
        ]);
    }
666264
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $remote = $input->getOption('remote');

        $persistence = $this->getPersistence();

        if (null === $remote) {
            $dialog = $this->getHelper('dialog');

            $remote = $dialog->ask($output, 'Please enter a Git remote to clone and pull from and to push to: ');

            if (!$dialog->askConfirmation($output, '<question>'.$remote.' will be cloned into '.$persistence->getDirectoryName().'. Continue? [y] </question>', false)) {
                $output->writeln('Not cloning, cancelled.');

                return;
            }
        }

        $output->writeln('Cloning...');
        $persistence->cloneRepository($remote);

        $output->writeln(sprintf('Init of git repository for remote "%s" in %s successful', $remote, $persistence->getDirectoryName()));
    }
965828
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);

        $configurationIdentifier = $input->getArgument('identifier');
        $configurationValue = json_encode($this
            ->configurationManager
            ->get($configurationIdentifier));

        $this->printMessage(
            $output,
            'Configuration',
            $configurationIdentifier . ' : "' . $configurationValue . '"'
        );

        $this->finishCommand($output);
    }
739175
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateCommand($input);

        $output->writeln('> Loading configuration file');
        $config = $input->getOption('config');
        $files = (new ConfigResolver())->getFileList($config);
        $output->writeLn('- Found '.count($files).' files');

        $preloader = (new Factory())->create($this->getOptions($input));

        $outputFile = $input->getOption('output');
        $handle = $preloader->prepareOutput($outputFile, $input->getOption('strict_types'));

        $output->writeln('> Compiling classes');

        $count = 0;
        $countSkipped = 0;
        $comments = !$input->getOption('strip_comments');

        foreach ($files as $file) {
            $count++;

            try {
                $code = $preloader->getCode($file, $comments);
                $output->writeln('- Writing '.$file);
                fwrite($handle, $code."\n");
            } catch (VisitorExceptionInterface $e) {
                $countSkipped++;
                $output->writeln('- Skipping '.$file);
            }
        }

        fclose($handle);

        $output->writeln("> Compiled loader written to $outputFile");
        $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')');
        $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb');
    }
623294
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $outputFile = null;
        if ($file = $input->getOption('output-file')) {
            $outputFile = $file;
        }
        $this->service($input->getArgument($this->argument), $outputFile);
    }
689124
public function execute(InputInterface $input, OutputInterface $output)
    {
        $uri = $input->getArgument('uri');

        $data = $input->getParameterOption(['--data', '-d']);
        if (file_exists($data)) {
            $data = file_get_contents($data);
        }

        client()->createRequest($uri);

        if (false === strpos(client()->getProtocol(), 'http') && empty($data)) {
            $data = ' ';
        }

        $response = client()->send($data);

        if ($input->hasParameterOption(['--json'])) {
            $json = $response->getContents();
            $header = '';
            foreach ($response->getHeaders() as $key => $value) {
                $header .= $key.': '.$response->getHeaderLine($key).PHP_EOL;
            }
            $response = $header."\r\n".json_encode(json_decode($json, true), JSON_PRETTY_PRINT);
        } elseif (false !== strpos(client()->getProtocol(), 'http')) {
            $response = (string) $response;
        } else {
            $response = $response->getContents();
        }

        $output->writeln($response);

        return 0;
    }
399638
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($this->validator()->fails()) {
            $this->error($this->formatErrors());
            // Exit with status code 1
            return 1;
        }

        return parent::execute($input, $output);
    }
376279
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $name = $input->getArgument('name');

        $cpath = app_path().'/controllers/';
        $filename = $name.'.php';
        $filepath = $cpath.$filename;

        if (file_exists($filepath)) {
            unlink($filepath);
            $output->writeln("<info>Controller: $name was deleted</info>");

            shell_exec('composer dump-autoload -o');
        } else {
            $output->writeln("<error>Controller: $name doesn't exists!");
        }
    }