Skip to content

Commit 9185e5a

Browse files
authored
Add DocC documentation for swiftly (#131)
Add DocC documentation for swiftly Create a plugin and tool that can generate a CLI reference for swiftly and generate the current latest document. Organize the help into a GSG (Getting Started Guide), a selection of HOWTOS, and Reference topics. Write an initial version of each. Create a Swift Package Index metadata file so that swiftly can be submitted there once the documentation is ready. Update the RELEASING.md file to check the documentation sanity and command-line reference, regenerating it if necessary.
1 parent c192812 commit 9185e5a

16 files changed

+1073
-7
lines changed

.spi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [SwiftlyDocs]

Documentation/EmptyFile.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is an empty placeholder swift file for the documentation target.
2+
3+
// You can preview the documentation here by running the following command:
4+
// swift package --disable-sandbox preview-documentation --target SwiftlyDocs
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ``SwiftlyDocs``
2+
3+
Install and manage your Swift programming language toolchains.
4+
5+
@Metadata {
6+
@DisplayName("Swiftly")
7+
}
8+
9+
## Topics
10+
11+
- <doc:getting-started>
12+
13+
### HOWTOS
14+
15+
- <doc:install-toolchains>
16+
- <doc:uninstall-toolchains>
17+
- <doc:update-toolchain>
18+
19+
### Reference
20+
21+
- <doc:swiftly-cli-reference>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Getting Started with Swiftly
2+
3+
To download swiftly and install Swift, run the following in your terminal, then follow the on-screen instructions:
4+
5+
```
6+
curl -L https://swiftlang.github.io/swiftly/swiftly-install.sh | bash
7+
```
8+
9+
Once swiftly is installed you can use it to install the latest available swift toolchain like this:
10+
11+
```
12+
$ swiftly install latest
13+
14+
Fetching the latest stable Swift release...
15+
Installing Swift 5.8.1
16+
Downloaded 488.5 MiB of 488.5 MiB
17+
Extracting toolchain...
18+
Swift 5.8.1 installed successfully!
19+
20+
$ swift --version
21+
22+
Swift version 5.8.1 (swift-5.8.1-RELEASE)
23+
Target: x86_64-unknown-linux-gnu
24+
```
25+
26+
Or, you can install (and use) a swift release:
27+
28+
```
29+
$ swiftly install --use 5.7
30+
31+
$ swift --version
32+
33+
Swift version 5.7.2 (swift-5.7.2-RELEASE)
34+
Target: x86_64-unknown-linux-gnu
35+
```
36+
37+
There's also an option to install the latest snapshot release and get access to the latest features:
38+
39+
```
40+
$ swiftly install main-snapshot
41+
```
42+
43+
> Note: This last example just installed the toolchain. You can run "swiftly use" to switch to it and other installed toolchahins when you're ready.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Install Swift Toolchains
2+
3+
swiftly install
4+
5+
Installing a swift toolchain using swiftly involves downloading it securely and extracting it into a well-known location in your account. Here we will guide you through the different ways you can install a swift toolchain. You will need to install swiftly first. The [Getting Started](getting-started.md) guide is a good place to start with swiftly.
6+
7+
The easiest way to install a swift toolchain is to select the latest stable release:
8+
9+
```
10+
$ swiftly install latest
11+
```
12+
13+
If this is the only toolchain that is installed then swiftly will automatically "use" it so that when you run swift (or any other toolchain command) it will be this version.
14+
15+
```
16+
$ swift --version
17+
18+
Swift version 5.8.1 (swift-5.8.1-RELEASE)
19+
Target: x86_64-unknown-linux-gnu
20+
```
21+
22+
You can be very specific about the released version that you want. We can install the 5.6.1 version like this:
23+
24+
```
25+
$ swiftly install 5.6.1
26+
```
27+
28+
Once you've installed more than one toolchain you may notice that swift is on the first version that you installed, not the last one. Swiftly lets you quickly switch between toolchains by "using" them. There's a swiftly subcommand for that.
29+
30+
```
31+
$ swiftly use 5.6.1
32+
```
33+
34+
You can also combine install and use into one command to automate this process with the `--use` switch on the install subcommand:
35+
36+
```
37+
$ swiftly install --use 5.7.1
38+
```
39+
40+
Sometimes you want the latest available patch of a minor release, such as 5.7. Let's omit the patch number so that we get the latest patch.
41+
42+
```
43+
$ swiftly install 5.7
44+
Installing Swift 5.7.2
45+
```
46+
47+
Swiftly supports installing development snapshot toolchains. For example, you can install the latest available snapshot for the next major release using the "main-snapshot" selector and prepare your code for when it arrives.
48+
49+
```
50+
$ swiftly install main-snapshot
51+
```
52+
53+
If you are tracking down a problem on a specific snapshot you can download it using the date.
54+
55+
```
56+
$ swiftly install main-snapshot-2022-01-28
57+
```
58+
59+
The same snapshot capabilities are available for version snapshots too either the latest available one, or a specific date.
60+
61+
```
62+
$ swiftly install 5.7-snapshot
63+
$ swiftly install 5.7-snapshot-2022-08-30
64+
```
65+
66+

0 commit comments

Comments
 (0)