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

mystery config command / help doesn't respond to command abbreviations #4151

Open
joachim-n opened this issue Aug 15, 2019 · 12 comments
Open

Comments

@joachim-n
Copy link
Contributor

Describe the bug

I ran into this problem on a new site I'd spun up, where I forgot to enable config_devel module. I was trying to use config_devel to export config to my module:

$ drush @local.fresh cde mymodule
 [error]  Config mymodule does not exist
 $ drush @local.fresh help cde:
  cde command not found.
$ drush @local.fresh cde
 Choose a configuration:
  [0  ] Cancel
  [1  ] automated_cron.settings
  [2  ] block.block.bartik_account_menu
  [3  ] block.block.bartik_branding
  [4  ] block.block.bartik_breadcrumbs
SNIP

So some command is being run, but NOT the one in config_devel (since it's not enabled -- and I checked it's not being run by adding die() to the top of the PHP file: it's not being loaded at all).

But I don't know WHICH command is being run, because the help system won't tell me!

So the problem is this: if 'drush foo' causes a command to run, because it's perhaps
detecting that 'foo' partially matches a command name, then 'drush help foo' should also work.

Expected behavior

Either:

  • tell me that command cde doesn't exist and not try to run a command
  • tell me what command cde actually is when I ask for help on it

System Configuration

Q A
Drush version? 9.7.0
Drupal version? 8.x
PHP version 7.2
OS? Mac
@greg-1-anderson
Copy link
Member

Do you know why drush @local.fresh cde mymodule does not work, but drush @local.fresh cde does?

@joachim-n
Copy link
Contributor Author

I don't know, as I can't figure out what command cde runs when Config Devel is absent, because help won't tell me. I imagine it's some sort of config-related command. And cde mymodule doesn't work because it's expecting a config name as a parameter, and mymodule isn't one.

@greg-1-anderson
Copy link
Member

Oh, helps if I read the [error] line more carefully. The command is running, it is just failing with an error. So the problem is that help is not finding commands that require a bootstrap. That's a bug we should fix.

Workaround:

$ drush @local.fresh cde --help

@joachim-n
Copy link
Contributor Author

$ drush @local.fresh cde --help

In HelpCommands.php line 58:

  cde command not found.

@joachim-n
Copy link
Contributor Author

I just tried using --debug, but that doesn't say which command class is being run. Might be a useful addition?

@greg-1-anderson
Copy link
Member

Bah, I thought that help used to work with module commands. Looks like it is quite broken now though.

@greg-1-anderson
Copy link
Member

Oh, right, it's never worked for disabled modules. Forgot about that.

@joachim-n
Copy link
Contributor Author

Oh, right, it's never worked for disabled modules

But it's not actually about that.

I get this:

$ drush @local.fresh cde foo
 [error]  Config foo does not exist

even if I delete the whole of the config_devel folder.

Some mystery command is picking up cde.

@greg-1-anderson
Copy link
Member

A PR to add a debug log showing the command class + namespace would be welcome.

@joachim-n
Copy link
Contributor Author

A PR to add a debug log showing the command class + namespace would be welcome.

Looks to be non-simple, see issue I've just filed on AC ^^.

@joachim-n
Copy link
Contributor Author

joachim-n commented Aug 17, 2019

Ok, getting weirder. For want of debug output, I added a dump() to CommandProcessor::runCommandCallback(), to output which class is about to be run for the command. And it's NOT RUN when I do drush @local.fresh cde foo.

@weitzman
Copy link
Member

You are running config:delete which has an alias cdel. I suspect you are running into a Symfony Console feature which guesses the command you meant to type. I guess it doesn't do so for remote help. I'm not sure if this is best fixed in Drush or Symfony Console.

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

3 participants