Interacts with the user to retrieve host configurations.

@param OutputStyle $io
515659
private function interactForHostConfigurations(OutputStyle $io)
    {
        $io->writeln(' Add host configurations:');

        $addHost = true;
        while ($addHost) {
            $stage = $io->choice('Stage', array(
                Host::STAGE_PRODUCTION,
                Host::STAGE_ACCEPTANCE,
                Host::STAGE_TEST,
            ));
            $hostname = $io->ask('Hostname');
            $path = $io->ask('Workspace path');
            $connectionType = $io->ask('Connection type (eg. local or ssh)');

            $this->configuration['hosts'][] = array(
                'stage' => $stage,
                'connectionType' => $connectionType,
                'hostname' => $hostname,
                'path' => $path,
            );

            $addHost = $io->confirm('Add another host?');
        }
    }
415281
public function runTransient(InputInterface $input=null,
        OutputInterface $output=null
    ) {
        foreach ($this->getEnvironmentMessages() as $message => $style) {
            $this->printLn($message, $style);
        }
    }
49804
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);

        $editor = new Editor($io, $config);
        $editor->setHook((string) $input->getArgument('hook'))
               ->setChange('AddAction');

        $editor->run();
    }
717758
public static function configure(IOInterface $io, PhpCsFixer $phpCsFixer)
    {
        if (true === $phpCsFixer->isUndefined()) {
            $answer = $io->ask(HookQuestions::PHPCSFIXER_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);

            $phpCsFixer = $phpCsFixer
                ->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));

            if (true === $phpCsFixer->isEnabled()) {
                $psr0Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR0_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
                $psr1Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR1_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
                $psr2Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR2_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
                $symfonyAnswer = $io->ask(HookQuestions::PHPCSFIXER_SYMFONY_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);

                $phpCsFixer = $phpCsFixer->addLevels(new PhpCsFixerLevels(
                    new Level(HookQuestions::DEFAULT_TOOL_ANSWER ===  strtoupper($psr0Answer)),
                    new Level(HookQuestions::DEFAULT_TOOL_ANSWER ===  strtoupper($psr1Answer)),
                    new Level(HookQuestions::DEFAULT_TOOL_ANSWER ===  strtoupper($psr2Answer)),
                    new Level(HookQuestions::DEFAULT_TOOL_ANSWER ===  strtoupper($symfonyAnswer))
                ));
            }

            $optionsAnswer = $io->ask(HookQuestions::PHPCSFIXER_OPTIONS, null);
            $options = new PhpCsFixerOptions($optionsAnswer);
            $phpCsFixer = $phpCsFixer->setOptions($options);
        }

        return $phpCsFixer;
    }
133478
protected function configureIO(InputInterface $input, OutputInterface $output)
    {
        if (true === $input->hasParameterOption(array('--ansi'), true)) {
            $output->setDecorated(true);
        } elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) {
            $output->setDecorated(false);
        }

        if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) {
            $input->setInteractive(false);
        } elseif (function_exists('posix_isatty')) {
            $inputStream = null;

            if ($input instanceof StreamableInputInterface) {
                $inputStream = $input->getStream();
            }

            // This check ensures that calling QuestionHelper::setInputStream() works
            // To be removed in 4.0 (in the same time as QuestionHelper::setInputStream)
            if (!$inputStream && $this->getHelperSet()->has('question')) {
                $inputStream = $this->getHelperSet()->get('question')->getInputStream(false);
            }

            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
                $input->setInteractive(false);
            }
        }

        if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
            $input->setInteractive(false);
        } else {
            if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || $input->getParameterOption('--verbose', false, true) === 3) {
                $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
            } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || $input->getParameterOption('--verbose', false, true) === 2) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
            } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
            }
        }
    }
1263419
protected static function genSecretConfig(IOInterface $io)
    {
        $dist = getcwd() . '/.env.dist';
        $dest = getcwd() . '/.env';

        $env = file_get_contents($dist);

        if ($io->askConfirmation("\nDo you want to use database? [Y/n]: ", true)) {
            $vars = [];

            $supportedDrivers = [
                1 => 'mysql',
                2 => 'postgresql',
                3 => 'sqlsrv'
            ];

            $io->write('');
            $io->write('Supported database drivers:');

            foreach ($supportedDrivers as $k => $v) {
                $io->write(sprintf('  - [%s] %s', $k, $v));
            }

            $io->write('');

            $driver = $io->ask('Database driver [1]: ', '1');

            $vars['DATABASE_DRIVER']   = $supportedDrivers[$driver] ?? 'mysql';
            $vars['DATABASE_HOST']     = $io->ask('Database host [localhost]: ', 'localhost');
            $vars['DATABASE_NAME']     = $io->ask('Database name [acme]: ', 'acme');
            $vars['DATABASE_USER']     = $io->ask('Database user [root]: ', 'root');
            $vars['DATABASE_PASSWORD'] = $io->askAndHideAnswer('Database password: ');

            foreach ($vars as $key => $value) {
                $env = preg_replace('/' . $key . '=(.*)/', $key . '=' . $value, $env);
            }
        }

        file_put_contents($dest, $env);

        $io->write('');
        $io->write('Database config setting complete.');
        $io->write('');
    }
575087
protected function displayResult(StyleInterface $io, array $results) {

        $exitCode = 0;

        $rows = [];

        $success = $this->getCheckbox(true);
        $warning = $this->getCheckbox(false);

        // Handle each result.
        foreach ($results as $bundle => $assets) {
            foreach ($assets as $asset => $result) {

                $rows[] = [
                    true === $result ? $success : $warning,
                    $bundle,
                    basename($asset),
                ];

                $exitCode += true === $result ? 0 : 1;
            }
        }

        // Displays a table.
        $io->table(["", "Bundle", "Asset"], $rows);

        return $exitCode;
    }
1122934
public function interactConfigIdentical(
    InputInterface $input,
    OutputInterface $output,
    AnnotationData $annotationData
  ) {
    $cm_strategies = [
      'config-split',
      'core-only',
    ];
    if (in_array($this->getConfigValue('cm.strategy'), $cm_strategies) && $this->getInspector()->isDrupalInstalled()) {
      if (!$this->getInspector()->isActiveConfigIdentical()) {
        $this->logger->warning("The active configuration is not identical to the configuration in the export directory.");
        $this->logger->warning("This means that you have not exported all of your active configuration.");
        $this->logger->warning("Run <comment>drush cex</comment> to export the active config to the sync directory.");
        if ($this->input()->isInteractive()) {
          $this->logger->warning("Continuing will overwrite the active configuration.");
          $confirm = $this->confirm("Continue?");
          if (!$confirm) {
            throw new BltException("The active configuration is not identical to the configuration in the export directory.");
          }
        }
      }
    }
  }
671913
public function render(IO $io, $indentation = 0)
    {
        if ($this->config->getDisplayName() && $this->config->getVersion()) {
            $paragraph = new Paragraph("{$this->config->getDisplayName()} version <c1>{$this->config->getVersion()}</c1>");
        } elseif ($this->config->getDisplayName()) {
            $paragraph = new Paragraph("{$this->config->getDisplayName()}");
        } else {
            $paragraph = new Paragraph('Console Tool');
        }

        $paragraph->render($io, $indentation);
    }
86520
protected function configureIO(Input $input, Output $output) {
        if (true === $input->hasParameterOption(['--ansi'])) {
            $output->setDecorated(true);
        }
        elseif (true === $input->hasParameterOption(['--no-ansi'])) {
            $output->setDecorated(false);
        }

        if (true === $input->hasParameterOption(['--no-interaction', '-n'])) {
            $input->interactive = false;
        }

        if (true === $input->hasParameterOption(['--quiet', '-q'])) {
            $output->setVerbosity(Output::VERBOSITY_QUIET);
        }
        else {
            if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
                $output->setVerbosity(Output::VERBOSITY_DEBUG);
            }
            elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
                $output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE);
            }
            elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
                $output->setVerbosity(Output::VERBOSITY_VERBOSE);
            }
        }
    }
24071
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'));

        $configurator = new Creator($io, $config);
        $configurator->force($input->getOption('force'))
                     ->extend($input->getOption('extend'))
                     ->advanced($input->getOption('advanced'))
                     ->run();
    }
1186797
public function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->in  = $input;
        $this->out = $output;
    }
400018
protected function findGApiAccessTokenFileConfig(OutputInterface $output)
    {
        try {
            $dataFromConfigFile = $this->extractGApiAuthConfigSettings($this->getDataFromConfigFile($output), $output);
        } catch (\RuntimeException $exception) {
            $this->writeError($output, 'Couldn\'t read a configuration file: '.$exception->getMessage());
            return null;
        }


        if (isset($dataFromConfigFile['gApiAccessTokenFile'])) {
            return $dataFromConfigFile['gApiAccessTokenFile'];

        }
        //else
        return null;
    }
481063
protected function printUsableConfig(
        OutputInterface $output,
        $config
    ) {
        foreach ($config['group'] as $group) {
            $output->writeln('#   --group="' . $group . '"');
        }
        $output->writeln('#   --group-type="' . $config['group-type'] . '"');
        $output->writeln('#   --group-skip-empty="' . ($config['group-skip-empty'] ? 'true' : 'false') . '"');
        $output->writeln('#   --sort-type="' . $config['sort-type'] . '"');
        $output->writeln('#   --sort-direction="' . $config['sort-direction'] . '"');
    }
1194065
public function execute(InputInterface $input, OutputInterface $output)
    {
        $host = $input->getArgument('host');

        $remove = $this->hostFile->remove($host);

        $output->writeLn("$host was removed from file.");
    }
1324908
protected static function configureFormatter(OutputInterface $output)
    {
        $formatter = $output->getFormatter();
        $formatter->setStyle('system', new OutputFormatterStyle('green'));
        $formatter->setStyle('line', new OutputFormatterStyle('yellow'));
        $formatter->setStyle('fail', new OutputFormatterStyle('red'));
        $formatter->setStyle('info', new OutputFormatterStyle('blue'));
        $formatter->setStyle('body', new OutputFormatterStyle('white'));
        $formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
    }
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);
    }