Closed (duplicate)
Project:
Drush
Version:
8.x-6.x-dev
Component:
Base system (internal API)
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
14 Apr 2013 at 07:53 UTC
Updated:
11 Sep 2013 at 11:57 UTC
It would be useful if a command completion callback had information about the parameters given so far.
For example, for the module builder 'mb' command"
$ drush mb modulename hookname hookname hookname
I can autocomplete hook names. But if I knew which position the user was at, I could also offer to autocomplete the names of existing modules.
Comments
Comment #1
moshe weitzman commentedComment #2
owen barton commentedThe challange here is that the complete callback results are cached, so we can rapidly complete subsequent responses from the cache without needing to bootstrap Drupal (which is slow, relative to the normal completion response time). In other words, for caching to work, we need to be able to capture all posisble completions for a command.
I can see your point about argument order though - it seems like we could easily provide a mechanism for providing argument-position specific completion results for commands that take arguments with different meaning/content. The last argument would presumably repeat for all subsequent arguments.
This wouldn't allow subsequent arguments to depend upon prior arguments for context however (because of the caching) - for that we would need to return some kind of tree like a nested array, perhaps with some way to reference other parts of the tree (to prevent duplication). I'll have a think - there may be some simple way to extend the existing structure to allow this.
Comment #3
greg.1.anderson commentedThis issue was marked
closed (won't fix)because Drush has moved to Github.If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to
closed (duplicate).Please ask support questions on Drupal Answers.
Comment #4
joachim commentedhttps://github.com/drush-ops/drush/issues/82