urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.89k stars 1.69k forks source link

Make it possible to `source` the Zsh autocomplete script #1896

Closed bartekpacia closed 1 month ago

bartekpacia commented 1 month ago

What type of PR is this?

What this PR does / why we need it:

This PR updates the default Zsh autcompletion script so it can be sourced. This makes debugging/testing autocompletion easier, because there's no need to copy this file to zsh/site-functions dir and rename it.

I first described this problem in https://github.com/urfave/cli/issues/1874

I also formatted this file with shfmt.

Which issue(s) this PR fixes:

Related to #1874.

I'm not sure if the same problem occurs in Bash. I'll check when I have more free time and possibly fix it in another PR.

Special notes for your reviewer:

None.

Testing

Tested locally.

I use this version of the zsh_autocomplete script in my own CLI programs, and it works as intended. Example: bartekpacia/emu.

Release Notes

bartekpacia commented 1 month ago

Those are on my list :)

meatballhat commented 1 month ago

@bartekpacia Please merge whenever you're ready 😁 And we've got auto-merge set up here, which you're welcome to turn on for any PRs.