
| Current Path : /var/www/html/konvbav/vendor/drush/drush/src/Commands/generate/Generators/Drush/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/konvbav/vendor/drush/drush/src/Commands/generate/Generators/Drush/DrushAliasFile.php |
<?php
declare(strict_types=1);
namespace Drush\Commands\generate\Generators\Drush;
use DrupalCodeGenerator\Asset\AssetCollection as Assets;
use DrupalCodeGenerator\Attribute\Generator;
use DrupalCodeGenerator\Command\BaseGenerator;
use DrupalCodeGenerator\GeneratorType;
use Drush\Drush;
#[Generator(
name: 'drush:alias-file',
description: 'Generates a Drush site alias file.',
aliases: ['daf'],
templatePath: __DIR__,
type: GeneratorType::OTHER,
)]
class DrushAliasFile extends BaseGenerator
{
/**
* {@inheritdoc}
*/
protected function generate(array &$vars, Assets $assets): void
{
$ir = $this->createInterviewer($vars);
$vars['prefix'] = $ir->ask('File prefix (one word)', 'self');
$vars['root'] = $ir->ask('Path to Drupal root', Drush::bootstrapManager()->getRoot());
$vars['uri'] = $ir->ask('Drupal uri', Drush::bootstrapManager()->getUri() ?: null);
$vars['host'] = $ir->ask('Remote host');
if ($vars['host']) {
$vars['user'] = $ir->ask('Remote user', Drush::config()->user());
}
$assets->addFile('drush/{prefix}.site.yml', 'drush-alias-file.yml.twig');
}
}