Closed cojoj closed 7 years ago
I'd love for Marathon to have auto completion support for all shells, I just started with zsh because that's what I use. I also went with the "generate a string in Swift" approach simply because I had a really hard time understanding how Zsh autocompletion worked, and once I got something working, I just pushed that 😅 There's definetly a lot of room for improvements, and I really welcome PRs in this area 👍
Since autocompletions are not "installed" by Marathon (for zsh it requires you to add the ~/.marathon/zsh
folder), I don't think there's any harm generating that folder even if the user doesn't currently use zsh. Having to check for the current shell just adds complication, so I'd rather avoid that.
If we for example implement autocompletion for fish, we can simply put it in a fish
folder next to the zsh
one.
What do you think @cojoj?
I'd introduce one more level to this called autocompltions
and inside have this distinction into different shells. Why? First of all, we don't have to pollute root directory with a couple of shell related directories. Secondly, if we decide to generate auto completions and reuse them in all shell generators - that'd be way cleaner approach.
I'll try to think about it more and come up with a PR presenting my vision 😉 So later we can decide in which direction we want to go.
Sure, sounds good! 👍 shouldn't be too many people using the zsh autocomplete yet either, since it hasn't been announced anywhere yet (except a note in the README), so I don't think changing the folder hierarchy is a big deal at this point.
I'm a
fish
user and I really love the autocompletion in it, so I'm also really happy that Marathon supports this forzsh
. I've decided that I'll extend Marathon's great user experience tofish
and it's rather easy task, but some thoughts came to my mind during the investigation. Here they are...First of all,
installShellAutocompleteIfNeeded
installszsh
completions no matter what kind of the shell you're using, so~/.marathon
looks like this (out of the box), even though I don't havezsh
on my computer:I have 2 proposals:
installShellAutocompleteIfNeeded
should check for the shell which user is actually using and install completions only for it..marathon/zsh
to.marathon/autocompletions
to be more generic.I think that second option could be better since those completion files aren't big and they can't make any harm.
Another thing is that Marathon is using custom script from
ZshAutocompleteInstaller
to generate a string which is later appended to the file. It's cool that we want to keep everything in Swift, but IMO, at some point this can become a huge pain. Bothfish
andzsh
(and probably more) are using scripts to achieve autocompletion, so why not write them and keep them in repo, or as a dependency? I'm also thinking about some sort of abstraction layer, so each completion can actually use one set of completions and then generate from this file a proper autocompletion scripts for each shell which Marathon will support. Just thinking in DRY mode right now 😅