Did you know the Swift Argument Parser can generate shell completion scripts automatically? 📖✨

Discover these hidden gems and more advanced features that can make your CLI tools more professional and user-friendly!

https://SwiftToolkit.dev/posts/argument-parser-gems

Hidden Gems in the Swift Argument Parser - Part I

Discover lesser-known features: shell completion scripts and improving completion suggestions

@swifttoolkit If you install Swift command-line tools with Homebrew, it does the completion script generation and registration automatically for you. At least after I updated the ones supporting this feature yesterday with https://github.com/Homebrew/homebrew-core/pull/233732. 😉

You only need to configure this once: https://docs.brew.sh/Shell-Completion

Generate completion scripts for Swift tools by SimplyDanny · Pull Request #233732 · Homebrew/homebrew-core

Swift packages using Swift Argument Parser for their CLI should be able to generate completion scripts themselves with the --generate-completion-script. Not sure if multiple formulae can be updated...

GitHub
@SimplyDanny thanks for linking your PR! I wondered if Homebrew installations get any benefits. I'll add a note to the article later today. Thank you!
@SimplyDanny sorry it took me so long! With the second part published, I also added a section to the first article, with your suggestion! Thank you again 🙏🏻