casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
20.25k stars 451 forks source link

Autocompletion for a just script? #2362

Open kbd opened 1 week ago

kbd commented 1 week ago

I've long had a setup program that makes symlinks to dotfiles, installs packages, etc. At some point I realized I could replace my code with just (thanks for that), so I rewrote it in terms of a justfile.

Now, I want autocomplete for my setup script. I tried making it a just script hoping that just+zsh would work some magic, but no such luck. I tried eval $(setup --completions zsh) on that just script, but nope. Is there a way of getting zsh to complete a just script? It works how I expect when doing just [tab] when there's a justfile in the current directory.

casey commented 1 week ago

Interesting idea! I'm not sure if this is possible, but I'll leave it open in case anyone has any ideas. I don't know if zsh or other shells can do autocompletion based on the shebang line of a binary, since in general just by knowing the shebang line, for example python or perl, you don't know anything about what arguments a script takes.