DannyBen / alf

Bash Alias Generator and Manager
MIT License
96 stars 4 forks source link

Can auto-complete feature be smarter? #36

Closed akefirad closed 3 years ago

akefirad commented 3 years ago

Currently the auto-complete suggests only and only the sub commands defined for a command, even if you already typed a sub-commands. For example if you type g s (i.e. git status), pressing tab shows the same aliases defined by alf. Following this issue, is it possible to merge the list of suggestions provided by alf the existing one (provided by zsh or other source). What's talking about is exactly the way git works. If you define an alias as a sub-commend you'd still get the original suggestion in addition to the defined aliases. Does that make sense to you?

DannyBen commented 3 years ago

Good question, and one that I have been asking myself for quite some time.

As far as I understand things, the answer is yes and no.

As I am sure you already know, completion is a rather complex subject. It differs between shells, and each program comes with usually rather long completion scripts.

Ideally, when using alf, I would like to be able to state that:

I do not know of a standard (cross-shell, cross program) way of doing so. If there was, then we could have added some config to alf so that users can make these statements in a configuration syntax, and alf would take care of the mechanics.

I have seen some one-liner commands in your zsh-in-docker image (in some of the config files) that did such tricks, for example:

# ~/.oh-my-zsh/plugins/git/git.plugin.zsh
compdef _git ggpnp=git-checkout

So bottom line:

  1. I think that as a user, you can find the way to make alf aliases and sub-aliases provide better completions.
  2. I think that alf itself is incapable of providing that, and I would love to be wrong here.

Thoughts?

akefirad commented 3 years ago

I'm not a bash pro, so I trust your evaluation. Thanks.