Some time ago I've provided SwiftPM with shell completion scripts (see PR #703 <https://github.com/apple/swift-package-manager/pull/703>) for both Bash and ZSH. These completions are quite useful as shown in the following gifs;
They are currently included with the SwiftPM project (see ZSH <https://github.com/apple/swift-package-manager/blob/master/Utilities/zsh/_swift> and Bash <https://github.com/apple/swift-package-manager/blob/master/Utilities/bash/completions>), but only available to those that checkout the SwiftPM repository. That's a pity because the completion scripts are very useful to beginners learning Swift to explore available commands and flags, but also speeds up experienced Swift users on the command line.
In order to reach the complete Swift community, I'd like to provide these scripts with the toolchain. In order to do this, I propose adding two files inside the toolchain at a location similar to the builtin completion scripts:
In order to keep these files up-to-date, I've written a SwiftPM command that generates these completions files, based on the arguments available to the various SwiftTool<> commands. At the moment the compiler flags are hard-coded, but I'm sure we can also find a way to provide these as well. PR #1256 <https://github.com/apple/swift-package-manager/pull/1256> is the shell completion script generator and PR #1257 <https://github.com/apple/swift-package-manager/pull/1257> is the output of that generator.
I'd like to get some input in whether and how we can include these scripts / files into the toolchain; how to automate the script generation such that they remain up-to-date with every Swift release; and a way to make users aware of these scripts -- instructions on how to enable them for their shell.