From 21894b2c6094507e33318ad538fcd77adfa6ee97 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Sat, 29 Mar 2025 08:46:14 -0400 Subject: [PATCH 1/3] Provide a fish shell toggle for swiftly one-liners Make code blocks wrap on limited horizontal space --- _includes/install/_linux_platforms_tabs.md | 39 ++++++++++++++++++---- assets/stylesheets/elements/_grid.scss | 20 +++++++++++ install/macos/index.md | 38 +++++++++++++++++---- 3 files changed, 83 insertions(+), 14 deletions(-) diff --git a/_includes/install/_linux_platforms_tabs.md b/_includes/install/_linux_platforms_tabs.md index fd8972220..4e989fce9 100644 --- a/_includes/install/_linux_platforms_tabs.md +++ b/_includes/install/_linux_platforms_tabs.md @@ -5,17 +5,42 @@

The Swiftly installer manages Swift and its dependencies. It supports switching between different versions and downloading updates.

-

Run this in a terminal:

-
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
-tar zxf swiftly-$(uname -m).tar.gz && \
-./swiftly init --quiet-shell-followup && \
-. ~/.local/share/swiftly/env.sh && \
-hash -r
-
+
Run this in a terminal:
+

License: Apache-2.0 | PGP: Signature

Instructions + + + + ## Other Install Options From 12e39f006c4ed19021e2a25512737334fa21f86b Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Sat, 29 Mar 2025 09:16:16 -0400 Subject: [PATCH 2/3] Make fish commands conditional on SWIFTLY_HOME_DIR Correct the default Linux swiftly home paths --- _includes/install/_linux_platforms_tabs.md | 6 ++++-- install/macos/index.md | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_includes/install/_linux_platforms_tabs.md b/_includes/install/_linux_platforms_tabs.md index 4e989fce9..bb86824c6 100644 --- a/_includes/install/_linux_platforms_tabs.md +++ b/_includes/install/_linux_platforms_tabs.md @@ -24,11 +24,13 @@ function setShell() { if (shell == "sh") { shell = "fish"; - code.innerText += ". ~/.swiftly/env.fish" + code.innerText = code.innerText.replace("$(", "(") // Subshells are invoked differently in fish + code.innerText = code.innerText.replace("$(", "(") + code.innerText += "set -q SWIFTLY_HOME_DIR && . \"$SWIFTLY_HOME_DIR/env.fish\" || . ~/.local/share/swiftly/env.fish" shellToggle.innerText = "sh"; } else { shell = "sh"; - code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.swiftly}/env.sh && \\\n" + code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.local/share/swiftly}/env.sh && \\\n" code.innerText += "hash -r" shellToggle.innerText = "fish"; } diff --git a/install/macos/index.md b/install/macos/index.md index e3cee1151..ef5c49b49 100644 --- a/install/macos/index.md +++ b/install/macos/index.md @@ -40,7 +40,7 @@ function setShell() { if (shell == "sh") { shell = "fish"; - code.innerText += ". ~/.swiftly/env.fish" + code.innerText += "set -q SWIFTLY_HOME_DIR && . \"$SWIFTLY_HOME_DIR/env.fish\" || . ~/.swiftly/env.fish" shellToggle.innerText = "sh"; } else { shell = "sh"; From 22d9a3e7e98243ed220861a50481936bb69a9750 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Sat, 29 Mar 2025 14:03:16 -0400 Subject: [PATCH 3/3] Put protective quotes around the home directory expansion --- _includes/install/_linux_platforms_tabs.md | 2 +- install/macos/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/install/_linux_platforms_tabs.md b/_includes/install/_linux_platforms_tabs.md index bb86824c6..c5d4e9768 100644 --- a/_includes/install/_linux_platforms_tabs.md +++ b/_includes/install/_linux_platforms_tabs.md @@ -30,7 +30,7 @@ function setShell() { shellToggle.innerText = "sh"; } else { shell = "sh"; - code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.local/share/swiftly}/env.sh && \\\n" + code.innerText += ". \"${SWIFTLY_HOME_DIR:-~/.local/share/swiftly}/env.sh\" && \\\n" code.innerText += "hash -r" shellToggle.innerText = "fish"; } diff --git a/install/macos/index.md b/install/macos/index.md index ef5c49b49..79643d35f 100644 --- a/install/macos/index.md +++ b/install/macos/index.md @@ -44,7 +44,7 @@ function setShell() { shellToggle.innerText = "sh"; } else { shell = "sh"; - code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.swiftly}/env.sh && \\\n" + code.innerText += ". \"${SWIFTLY_HOME_DIR:-~/.swiftly}/env.sh\" && \\\n" code.innerText += "hash -r" shellToggle.innerText = "fish"; }