stecman / symfony-console-completion

Automatic tab-key completion for Symfony console application options, arguments and parameters
MIT License
420 stars 26 forks source link

Add support for autocomplete descriptions #90

Open marcusirgens opened 4 years ago

marcusirgens commented 4 years ago

Adds support for zsh descriptions as requested in #63

stecman commented 4 years ago

Hey @marcusirgens, thanks for the PR :tada:

I like the direction this is going in - with a bit of work we can definitely fit this in.

My main concern with this initial API is that "description" is quite baked in, considering that only ZSH supports it. If someone wanted to add further metadata to command completions, they'd currently need to edit CompletionHandler directly which isn't ideal.

I'm also not a fan of CompletionResult representing a collection of results. I think it would make more sense as one instance per string so there's an obvious path to adding additional metadata. The current constructor that takes an associative array of name => description is fairly inflexible - for example, what if I wanted to add a color metadata value and set that on completions without using descriptions?

What I'd propose is:

I'm happy to work through these with you, or if you want to smash it out by yourself that's cool too.

marcusirgens commented 4 years ago

Hey, thanks for the feedback. I agree with your comments, I’ll make some changes and update this PR.