Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drupal/console-dotenv",
"description": "Drupal Console dotenv",
"description": "Drupal Console Dotenv",
"type": "drupal-console-library",
"license": "GPL-2.0+",
"authors": [
Expand Down
5 changes: 5 additions & 0 deletions console.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ services:
arguments: ['@app.root', '@?console.root']
tags:
- { name: drupal.command, bootstrap: uninstall }
console.dotenv_debug:
class: \Drupal\Console\Dotenv\Command\DebugCommand
arguments: ['@app.root', '@?console.root']
tags:
- { name: drupal.command, bootstrap: uninstall }
76 changes: 76 additions & 0 deletions src/Command/DebugCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Drupal\Console\Dotenv\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Core\Command\Shared\CommandTrait;
use Drupal\Console\Core\Style\DrupalStyle;
use Symfony\Component\Filesystem\Filesystem;
use Drupal\Component\Utility\Crypt;
use Webmozart\PathUtil\Path;

/**
* Class ExampleOneCommand
*
* @package Drupal\Console\Dotenv\Command
*/
class DebugCommand extends Command
{
use CommandTrait;

/**
* @var string
*/
protected $appRoot;

/**
* @var string
*/
protected $consoleRoot;

/**
* InitCommand constructor.
*
* @param string $appRoot
* @param string $consoleRoot
*/
public function __construct(
$appRoot,
$consoleRoot = null
)
{
$this->appRoot = $appRoot;
$this->consoleRoot = $consoleRoot?$consoleRoot:$appRoot;
parent::__construct();
}

protected function configure()
{
$this->setName('dotenv:debug')
->setDescription('Debug Dotenv debug values.');
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->debugFile($io);
}

private function debugFile(DrupalStyle $io) {
$fs = new Filesystem();
$envFile = $this->consoleRoot . '/.env';
if (!$fs->exists($envFile)) {
$io->warning('File '. $envFile . ' not found.');

return 1;
}

$fileContent = file_get_contents($envFile);
$io->writeln($fileContent);
}
}
2 changes: 1 addition & 1 deletion src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(
protected function configure()
{
$this->setName('dotenv:init')
->setDescription('Drupal Console dotenv.');
->setDescription('Dotenv initializer.');
}

/**
Expand Down