oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

We need a better system for handling completions

Open paxperscientiam opened this issue 4 years ago • 2 comments

It seems that completion files are being re-created even when unnecessary. The better way would be to leverage official/recognized completion libraries.

For example, sjorek provides a completion file for composer here. sjorek also suggests symfony-console-autocomplete here.

Here's one solution that comes to mind

  • remove from repo completions that our supported by the associated project
  • don't automatically install those completions
  • if a user adds to their completions variable, say, 'composer', give the user the option to have it installed by oh-my-bash the next time it's loaded.

Something like this, maybe:

if command -v composer; then
    composer global require bamarni/symfony-console-autocomplete
    symfony-autocomplete composer > ~/.oh-my-bash/completions/installed/composer
else 
    printf 'oh-my-bash: You have requested completion for composer, but composer is not installed\v'
fi

Something like that.

If there is interest, lemme know and I'll look into it.

EDIT: Another example source, for npm v6 -> v8

https://docs.npmjs.com/cli/v8/commands/npm-completion

paxperscientiam avatar Nov 19 '21 17:11 paxperscientiam

bump?

paxperscientiam avatar May 21 '22 18:05 paxperscientiam

I feel that should be controlled just by the array completions. I think the problem is that the default completions contains composer and ssh. As for the git completion, a related issue is #277, where we finally decided to search for the official completion first and only source the completion bundled with oh-my-bash when the official one is not found in the host. How about just removing composer and ssh from the default bashrc?

akinomyoga avatar May 21 '22 21:05 akinomyoga