News for hackers. Stuff that matters.
Re:OpenAutoComplete: Shell-agnostic, cross-platform autocomp... by freedomben on Thursday May 21, 2020 @12:46AM (#23254878)
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-complete scripts for various tools several times. I'm quite good with bash (if I may say so myself). I've written some fairly advanced scripts and have been doing it a long time. However, despite my existing experience, writing auto completion is still a major pain in the ass. This is an area that really needs improvement.

I don't know if this project is the correct answer. I think some good discussion should be had. But I do want to say that the problem they are solving is real.

Re:OpenAutoComplete: Shell-agnostic, cross-platform autocomp... by GamePad64 on Thursday May 21, 2020 @01:22AM (#23255077)
I'have just posted something like "request for comments" thing, so we could talk and make a proper solution. I've tried to use PowerShell in Windows, and it was pure pain: the tools, that are written in PS work fine, everything else (like git, InnoSetup, CMake, everything else...) just didn't have autocompletion at all. Maybe, some tools, like git do have shell plugins (like posh-git), but the problem in general still persists. Also, I am using Poetry and Werf utilities, that have built-in generator for autocomplete (bash, zsh and fish), but it doesn't work very well and the developers had to write it by themselves.

So, I've tried to make the spec as generic as possible, so it could support current compicated cases, like git (with its infinite number of commands and options), scp (with its remote file listing), some old Windows commands (like "format" for windows95 and so on).

Also, this format could be used with a single-pass recursive generator, because each usage pattern is just a JSON array and all its properties can be defined in-place. So, it would be okay to use it with languages, like C, that have no JSON serializer built-in.

Re:OpenAutoComplete: Shell-agnostic, cross-platform autocomp... by DelightOne on Thursday May 21, 2020 @08:26AM (#23257577)
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