mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 07:56:07 +01:00
Fix Console::addOption() breaking --env and --lang
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
* Added support for relative paths in `PageObject::getLevelListing()` [#3110](https://github.com/getgrav/grav/issues/3110)
|
||||
* Better `--env` and `--lang` support for `bin/grav`, `bin/gpm` and `bin/plugin` console commands
|
||||
* **BC BREAK** Shorthand for `--env`: `-e` will not work anymore as it conflicts with some plugins
|
||||
* **BC BREAK** Plugins should not add option for `--env` or `--lang` (in Grav <1.7 check if those are already defined)
|
||||
1. [](#bugfix)
|
||||
* Fixed port issue with `system.custom_base_url`
|
||||
* Hide errors with `exif_read_data` in `ImageFile`
|
||||
|
||||
@@ -19,11 +19,9 @@ use Grav\Console\Cli\ClearCacheCommand;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
use RocketTheme\Toolbox\File\YamlFile;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
@@ -72,6 +70,28 @@ trait ConsoleTrait
|
||||
$this->setupGrav();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an option.
|
||||
*
|
||||
* @param string $name The option name
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
|
||||
{
|
||||
if ($name !== 'env' && $name !== 'lang') {
|
||||
parent::addOption($name, $shortcut, $mode, $description, $default);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
final protected function setupGrav(): void
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user