drupal-console icon indicating copy to clipboard operation
drupal-console copied to clipboard

[standard] Autocomplete not working in bash in Ubuntu 19.04

Open anoopjohn opened this issue 4 years ago • 2 comments

[standard] Autocomplete not working in bash in Ubuntu 19.04

Problem/Motivation

I tried to enable autocomplete on bash in Ubuntu 19.04. I was not able to get it working out of the box.

Also per the documentation in README.md the package http://bash-completion.alioth.debian.org/ is required. However this URL is not valid.

How to reproduce

I followed the instructions for installation as per the README.md and as per the messages in the install process.

  • Drupal version - 8.7.7
  • Console version - 1.9.3
  • Console Launcher version - 1.9.3

More info

While sourcing console.rc separately I get this as well. Not sure if it is related

$ source ~/.console/console.rc 
                                           
  The "--learning" option does not exist.  
                                      
_completion [-g|--generate-hook] [-p|--program PROGRAM] [-m|--multiple] [--shell-type [SHELL-TYPE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

$ echo $?
0
$ 

Solution

Will need to find and fix the issue.

Documentation Fixes

Looks like there has to be some fixes in the documentation as well. https://salsa.debian.org/debian/bash-completion seems to be the URL for the bash-completion project.

anoopjohn avatar Oct 16 '19 16:10 anoopjohn

I have installed

$ composer require stecman/symfony-console-completion

I also have bash-completion installed in the system.

anoopjohn avatar Oct 16 '19 17:10 anoopjohn

I was trying to debug this further

When I run the command inside a Drupal folder I get

$ drupal _completion -g -p drupal
Error: Call to undefined method Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand::isMaintenance() in /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console-core/src/EventSubscriber/MaintenanceModeListener.php on line 80 #0 /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console-core/src/EventSubscriber/MaintenanceModeListener.php(66): Drupal\Console\Core\EventSubscriber\MaintenanceModeListener->switchMaintenanceMode(Object(Symfony\Component\Console\Event\ConsoleTerminateEvent), 'off')
#1 /home/anoopjohn/public_html/drupal/d8/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Drupal\Console\Core\EventSubscriber\MaintenanceModeListener->disableMaintenanceMode(Object(Symfony\Component\Console\Event\ConsoleTerminateEvent), 'console.termina...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 /home/anoopjohn/public_html/drupal/d8/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#3 /home/anoopjohn/public_html/drupal/d8/vendor/symfony/console/Application.php(1008): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#4 /home/anoopjohn/public_html/drupal/d8/vendor/symfony/console/Application.php(254): Symfony\Component\Console\Application->doRunCommand(Object(Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console-core/src/Application.php(188): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console/src/Application.php(64): Drupal\Console\Core\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /home/anoopjohn/public_html/drupal/d8/vendor/symfony/console/Application.php(147): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console/bin/drupal.php(89): Symfony\Component\Console\Application->run()
#9 /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console/bin/drupal(4): require('/home/anoopjohn...')
#10 {main}
Error: Call to undefined method Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand::isMaintenance() in Drupal\Console\Core\EventSubscriber\MaintenanceModeListener->switchMaintenanceMode() (line 80 of /home/anoopjohn/public_html/drupal/d8/vendor/drupal/console-core/src/EventSubscriber/MaintenanceModeListener.php).

When I run it outside the Drupal folder I get

$ drupal _completion -g -p drupal

                                           
  The "--learning" option does not exist.  
                                           

_completion [-g|--generate-hook] [-p|--program PROGRAM] [-m|--multiple] [--shell-type [SHELL-TYPE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

anoopjohn avatar Oct 16 '19 17:10 anoopjohn