Open poperigby opened 1 year ago
There is a script to parse fish completions generated from parsing man pages : https://github.com/nushell/nu_scripts/blob/main/custom-completions/auto-generate/parse-fish.nu . I also prefer nu to automatically parse man pages after installation and generate completions but not sure if that works cross platform.
Parsing the troff files is non-trivial. I have looked into doing this myself. Even if you just port that script from python to nushell, I bet it won't be easy.
Having said that, I LOVE to see a nushell port of that script. I also agree that we'd still want to store the completions since man pages don't really exist on Windows but some of the commands can be installed and used on Windows.
What do you think would be difficult about porting the script?
Mostly my personal ignorance of python. Have at it! I wish you success. :)
I mean, it is a script with over 1000 lines so just the volume of it makes it non-trivial.
If anyone coming here to check for external commands autocompletion, nushell supports external completers and checkout carapace
If anyone coming here to check for external commands autocompletion, nushell supports external completers and checkout carapace
Contributions to improve our internal completion story are still welcome nevertheless. Especially extensions to our completion engine that make it possible to use definition formats provided by other tools. We should strive to make the setup as seemless as possible.
FYI: there's also a manpage parser in murex.
See carapace-spec-man. Can't really recommend it though. Manpages are too much of a mess.
I looked into ROFF parsers too and I'm not sure how this "standard" ever existed. It's so complicated and such a mess, from what I remember. Now if we could just get someone to write a translator in rust. :)
Describe the solution you'd like
Fish does something very cool where it parses man pages to generate completions for programs. Would this be something usefull for nushell, so it doesn't entirely rely on manually created completions?
Here's their implementation: https://github.com/fish-shell/fish-shell/blob/master/share/tools/create_manpage_completions.py
Describe alternatives you've considered
There's already a small repository of completions in nu_scripts, and this is probably preferred, but these could never possibly cover all of the niche programs out there. Fish also has a repository of manually created completions for a lot of programs, and the man page parsing is used as a fallback, I believe.