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

Bouke Haarsma bouke at haarsma.eu
Wed Jul 12 05:00:52 CDT 2017

Any ideas?



On 2017-07-04 05:28:42 +0000, Bouke Haarsma via swift-evolution said:

> My message's formatting got all messed up, here's my plain text re-post:
> Some time ago I've provided SwiftPM with shell completion scripts (see 
> PR [#703][703]) for both Bash and ZSH. These completions are quite 
> useful as shown in the following gifs;
> Bash:
> ![Bash][1]
> ZSH:
> ![ZSH][2]
> They are currently included with the SwiftPM project (see [zsh][3] and 
> [bash][4]), 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:
>     /usr/local/share/zsh/functions/_swift
>     /usr/local/share/bash-completion/completions/swift
> 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][1256] is the shell completion script 
> generator and PR [#1257][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.

More information about the swift-evolution mailing list