5 ms·
I really want to see a cross-shell, declarative language for autocomplete definitions. Does such a thing exist?
by akdor1154 7y ago
I really want to see a cross-shell, declarative language for autocomplete definitions. Does such a thing exist?
- sullyj3 7y agohttps://www.redox-os.org/news/rsoc-ion-ux-2/ https://www.redox-os.org/news/rsoc-ion-ux-2/
- flukus 7y agoI wouldn't want to limit myself like that. The best home spun completions I've written will do things like look up values in a database, differ depending on previous arguments, parse some file, etc. These will never fit into a declarative language.
- lonelappde 7y agoYes it can. https://news.ycombinator.com/item?id=22500928 https://news.ycombinator.com/item?id=22500928
- chubot 7y agoThe "declarative" part doesn't really make sense IMO, but there are a bunch of links here about having a shell-agnostic system: https://github.com/oilshell/oil/wiki/Shell-Autocompletion https://github.com/oilshell/oil/wiki/Shell-Autocompletion https://github.com/oilshell/oil/wiki/Projects-Already-Doing-Something-Like-Shellac https://github.com/oilshell/oil/wiki/Projects-Already-Doing-... https://github.com/mbrubeck/compleat https://github.com/mbrubeck/compleat (one of the only grammar-based ones, looks nice but doesn't appear to have been used very much) There are some discussions about cross-shell autocompletion on the #shell-autocompletion channel of https://oilshell.zulipchat.com/ https://oilshell.zulipchat.com/, but it didn't go that far. The Ion work described in the sibling blog post went the furthest in terms of implementation I think, but I haven't heard anything about it in awhile.
- akdor1154 7y agoThese are awesome, thanks. By 'declarative' I mean some way of telling the shell how my bin can provide completions itself. E.g. for the AWS util, I am envisioning something like aws ec2 describe-instances --instance-id __INSTANCEID__ __INSTANCEID__: $(aws ec2 list-instances --query Instance.ID) Syntax here is not anything like a well thought out proposal, just a demonstration of what I believe to be a shell agnostic method of describing both 'where can I complete?' and 'how can I compete it?'
- dim-an 7y agoOn my Christmas holidays I built a little tool that does similar things. Features I wanted to include originally were 1 shell completion autogeneration from `--help` texts; 2 support bash/zsh/fish; 3 support toml-like description of command arguments. At the moment I have a tool that generates completions from `--help` messages and supports bash/zsh. I use it daily and it makes me little bit happier. [1] https://github.com/dim-an/cod https://github.com/dim-an/cod
- StavrosK 7y agoIt's called "cod" and doesn't support fish? :(
- dim-an 7y agoWhy would I need a fish if I already have cod? ;) Actually when I started this project I used fish as my main shell on laptop and first versions of cod did support fish, but then I decided to focus bash/zsh as they look more popular. I still want to add fish support when I have some time though. It doesn't look complicated.
- shellcomp 7y agoShameless plug: https://shellcomp.github.io/ https://shellcomp.github.io/
- nicoburns 7y agohttps://docs.rs/crate/shellac-server/0.3.1 https://docs.rs/crate/shellac-server/0.3.1