Live data from Hacker News

OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

github.com

21–27 of 27 posts

Re: OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

#21
This sounds like a great idea, and I'm sure there's people that would be willing to help (me included). Is there somewhere organized already for people to discuss the development, or where to contribute (Gitter, Discord, IRC, etc.)? I couldn't find anything mentioned in the GitHub pages.

Re: OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

#23

If we could get some standards defined and adopted, that would be amazing. There are so many CLI tools that could really benefit from auto-complete, but don't yet have it because it is a huge pain to write. Often times the auto-complete is significantly more work than the original tool was, in a couple cases I've written it was an order of magnitude more work to write the shell completion. I have tried writing auto-c…

I know what you mean. Go's spf13/cobra will soon have working zsh/bash/fish/powershell autocomplete generation!

https://github.com/spf13/cobra/pull/1070

Re: OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

#24
A few days ago, I came across kingpin [1] (a library for writing CLI applications in Go) which seems to have some kind of --completion-script-bash option which generates a completion script for you. It might be interesting in this context.

[1] https://github.com/alecthomas/kingpin#bashzsh-shell-completi...

Re: OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

#25

Earlier quoted context omitted.

> The problem I see is that Shellac is dynamic So OpenAutoComplete is purely static then? That makes it much less useful. Static completion is nice to have for tools you only use from time to time, or when fishing for that argument name, but if you don't know the name of an argument etc you will often have to use `man` anyway. The real benefit of completions are the dynamic ones, at least for me. If such a spec does…

Nope, it is not purely static. It is static-first (declarative), bot running a command and parsing its output or delegating the completion to some shell code is a planned feature.

You could make it dynamic with "bin -OpenAutoComplete" to have the binary output the Json. This would allow gradual introduction and backwards compatibility. It would also keep the completions up to date with binary versions, and still allow a shell to cache the Json.

More importantly, you should consider other metadata before you go to far; binaries could carry their own documentation, licensing, dependencies... What should be in and out of scope?

Re: OpenAutoComplete: Shell-agnostic, cross-platform autocomplete specification

#27
post #7

Can't you just parse --help in the background so we as developers don't need to write anything at all?

bash-completion already does that, and it works OK, but is limited. It's used on most Linux distros, so you've likely already used that code path.

It actually invokes --help dynamically you hit `` and parses the output dynamically. Whereas other systems do it offline in a batch job, e.g. some fish completions.

Post reply on HN