[swift-evolution] Publish shell completions scripts with the toolchain

Bouke Haarsma bouke at haarsma.eu
Mon Jul 3 14:09:13 CDT 2017

Hi all,
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;
ZSH: https://cloud.githubusercontent.com/assets/235882/18910036/805fb40a-8576-11e6-98ff-2114c9997bf6.gif <https://cloud.githubusercontent.com/assets/235882/18910036/805fb40a-8576-11e6-98ff-2114c9997bf6.gif>
Bash: https://cloud.githubusercontent.com/assets/235882/18910038/8468299c-8576-11e6-954e-7b6c5749bba9.gif <https://cloud.githubusercontent.com/assets/235882/18910038/8468299c-8576-11e6-954e-7b6c5749bba9.gif>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170703/58def11d/attachment.html>

More information about the swift-evolution mailing list