Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting editor #5670

Closed
aleixq opened this issue Jun 21, 2023 · 1 comment
Closed

Setting editor #5670

aleixq opened this issue Jun 21, 2023 · 1 comment

Comments

@aleixq
Copy link

aleixq commented Jun 21, 2023

Describe the bug
I have no way to change the editor ... And also it not detects the default (vi, nano, vim, and neovim installed ... ).
drush config:edit views.view.administerusersbyrole_people
or
EDITOR=vim drush config:edit views.view.administerusersbyrole_people

TypeError: Drush\Commands\config\ConfigCommands::getEditor(): Argument #1 ($editor) must be of type ?string, bool given, called in /drupal-project/vendor/drush/drush/src/Commands/config/ConfigCommands.php on line 235 in /drupal-project/vendor/drush/drush/src/Exec/ExecTrait.php on line 99 #0 /drupal-project/vendor/drush/drush/src/Commands/config/ConfigCommands.php(235): Drush\Commands\config\ConfigCommands::getEditor()
#1 [internal function]: Drush\Commands\config\ConfigCommands->edit()
#2 /drupal-project/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#3 /drupal-project/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#4 /drupal-project/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#5 /drupal-project/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#6 /drupal-project/vendor/symfony/console/Command/Command.php(312): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#7 /drupal-project/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#8 /drupal-project/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand()
#9 /drupal-project/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun()
#10 /drupal-project/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#11 /drupal-project/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#12 /drupal-project/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#13 /drupal-project/vendor/drush/drush/drush(4): require('...')
#14 /drupal-project/vendor/bin/drush(120): include('...')
#15 {main}
TypeError: Drush\Commands\config\ConfigCommands::getEditor(): Argument #1 ($editor) must be of type ?string, bool given, called in /drupal-project/vendor/drush/drush/src/Commands/config/ConfigCommands.php on line 235 in Drush\Commands\config\ConfigCommands::getEditor() (line 99 of /drupal-project/vendor/drush/drush/src/Exec/ExecTrait.php).
 [warning] Drush command terminated abnormally.

Adding drush.yml in webroot path with:

options:
  editor: "vim"

Is not working.

And setting in various ways in execution time like is saying in --help :

drush config:edit views.view.administerusersbyrole_people --editor=vim
The "--editor" option does not accept a value.
drush config:edit views.view.administerusersbyrole_people --editor vim
Too many arguments to "config:edit" command, expected arguments "config_name"

drush config:edit --editor vim views.view.administerusersbyrole_people
Too many arguments to "config:edit" command, expected arguments "config_name"

Gives other errors too.

Workaround
Is there another way to do the desired action?
hardcoding $options['editor'] in vendor/drush/drush/src/Commands/config/ConfigCommands.php in fact I end up setting as this:
235: $exec = self::getEditor($options['editor']?:"");

System Configuration

Q A
Drush version? 12.x
Drupal version? 10.x/
PHP version 8.1 and 8.2
OS? Linux
@weitzman
Copy link
Member

weitzman commented Jul 2, 2023

Fixed in #5683. You may now pass --editor=vim, for example.

If you want to set this via drush configuration, you must do so for each command you care about. --editor is not a global option. To set it for all commands, use EDITOR env variable. That is still working in my testing.

@weitzman weitzman closed this as completed Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants