From e628c54bcc0307716af96e8610f6c58531234edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sat, 29 Mar 2025 12:35:30 +0100 Subject: [PATCH 1/7] Polish welcome message --- Sources/Swiftly/Init.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 0895b38c..8ad208f8 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -67,21 +67,21 @@ struct Init: SwiftlyCommand { // Give the user the prompt and the choice to abort at this point. if !assumeYes { #if os(Linux) - let sigMsg = " In the process of installing the new toolchain swiftly will add swift.org GnuPG keys into your keychain to verify the integrity of the downloads." + let sigMsg = " In the process of installing the new toolchain, swiftly will add swift.org GnuPG keys into your keychain to verify the integrity of the downloads." #else let sigMsg = "" #endif let installMsg = if !skipInstall { - "\nOnce swiftly is installed it will install the latest available swift toolchain.\(sigMsg)\n" + "\nOnce swiftly is installed it will install the latest available Swift toolchain.\(sigMsg)\n" } else { "" } SwiftlyCore.print(""" - Swiftly will be installed into the following locations: + Swiftly will install files into the following locations: - \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Data and configuration files directory including toolchains - \(Swiftly.currentPlatform.swiftlyBinDir.path) - Executables installation directory + \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files + \(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain - These locations can be changed with SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables and run this again. + These locations can be changed by setting the environment variables SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again. \(installMsg) """) From d407eb0b86c3217814aa79dbcecc13e33fa683c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sat, 29 Mar 2025 22:15:31 +0100 Subject: [PATCH 2/7] Inline `hash -r` command --- Sources/Swiftly/Init.swift | 4 +--- Sources/Swiftly/Install.swift | 6 ++---- Sources/Swiftly/Update.swift | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 8ad208f8..d4e3843d 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -239,9 +239,7 @@ struct Init: SwiftlyCommand { // Fish doesn't have path caching, so this might only be needed for bash/zsh if pathChanged && !quietShellFollowup && !shell.hasSuffix("fish") { SwiftlyCore.print(""" - Your shell caches items on your path for better performance. Swiftly has added items to your path that may not get picked up right away. You can run this command to update your shell to get these items. - - hash -r + Your shell caches items on your path for better performance. Swiftly has added items to your path that may not get picked up right away. You can run 'hash -r' to update your shell in place. """) } diff --git a/Sources/Swiftly/Install.swift b/Sources/Swiftly/Install.swift index fa32a38c..86091228 100644 --- a/Sources/Swiftly/Install.swift +++ b/Sources/Swiftly/Install.swift @@ -112,10 +112,8 @@ struct Install: SwiftlyCommand { // Fish doesn't cache its path, so this instruction is not necessary. if pathChanged && !shell.hasSuffix("fish") { SwiftlyCore.print(""" - NOTE: We have updated some elements in your path and your shell may not yet be - aware of the changes. You can run this command to update your shell. - - hash -r + NOTE: Swiftly has updated some elements in your path and your shell may not yet be + aware of the changes. You can run 'hash -r' to update your shell in place. """) } diff --git a/Sources/Swiftly/Update.swift b/Sources/Swiftly/Update.swift index c7414369..9afb8666 100644 --- a/Sources/Swiftly/Update.swift +++ b/Sources/Swiftly/Update.swift @@ -137,10 +137,8 @@ struct Update: SwiftlyCommand { if pathChanged { SwiftlyCore.print(""" - NOTE: We have updated some elements in your path and your shell may not yet be - aware of the changes. You can run this command to update your shell. - - hash -r + NOTE: Swiftly has updated some elements in your path and your shell may not yet be + aware of the changes. You can run 'hash -r' to update your shell. """) } From 2f6bc85cb81d00e6b887cdc07321eb78ed836f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sat, 29 Mar 2025 22:16:37 +0100 Subject: [PATCH 3/7] List toolchain location and restructure message concatenation --- Sources/Swiftly/Init.swift | 45 +++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index d4e3843d..3972e509 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -66,24 +66,33 @@ struct Init: SwiftlyCommand { // Give the user the prompt and the choice to abort at this point. if !assumeYes { -#if os(Linux) - let sigMsg = " In the process of installing the new toolchain, swiftly will add swift.org GnuPG keys into your keychain to verify the integrity of the downloads." -#else - let sigMsg = "" -#endif - let installMsg = if !skipInstall { - "\nOnce swiftly is installed it will install the latest available Swift toolchain.\(sigMsg)\n" - } else { "" } - - SwiftlyCore.print(""" - Swiftly will install files into the following locations: - - \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files - \(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain - - These locations can be changed by setting the environment variables SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again. - \(installMsg) - """) + var msg = """ + Swiftly installs files into the following locations: + + \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files + \(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain + \(Swiftly.currentPlatform.swiftlyToolchainsDir.path) - Directory hosting installed toolchains + + These locations can be changed by setting the environment variables + SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again. + + """ + if !skipInstall { + msg += """ + + Once swiftly is set up, it will install the latest available Swift toolchain. + + """ + #if os(Linux) + msg += """ + In the process, swiftly will add swift.org GnuPG keys into your keychain to verify + the integrity of the downloads. + + """ + #endif + } + + SwiftlyCore.print(msg) guard SwiftlyCore.promptForConfirmation(defaultBehavior: true) else { throw SwiftlyError(message: "swiftly installation has been cancelled") From 410f40bad05c7e8d18e12edfb7f2dd9282d62f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sun, 30 Mar 2025 15:34:32 +0200 Subject: [PATCH 4/7] Place `hash -r` command on its own line --- Sources/Swiftly/Init.swift | 8 +++++++- Sources/Swiftly/Install.swift | 6 +++++- Sources/Swiftly/Update.swift | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 3972e509..35961bc1 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -248,7 +248,13 @@ struct Init: SwiftlyCommand { // Fish doesn't have path caching, so this might only be needed for bash/zsh if pathChanged && !quietShellFollowup && !shell.hasSuffix("fish") { SwiftlyCore.print(""" - Your shell caches items on your path for better performance. Swiftly has added items to your path that may not get picked up right away. You can run 'hash -r' to update your shell in place. + Your shell caches items on your path for better performance. Swiftly has added + items to your path that may not get picked up right away. You can update your + shell's environment by running + + hash -r + + or restarting your shell. """) } diff --git a/Sources/Swiftly/Install.swift b/Sources/Swiftly/Install.swift index 86091228..3bbb9299 100644 --- a/Sources/Swiftly/Install.swift +++ b/Sources/Swiftly/Install.swift @@ -113,7 +113,11 @@ struct Install: SwiftlyCommand { if pathChanged && !shell.hasSuffix("fish") { SwiftlyCore.print(""" NOTE: Swiftly has updated some elements in your path and your shell may not yet be - aware of the changes. You can run 'hash -r' to update your shell in place. + aware of the changes. You can update your shell's environment by running + + hash -r + + or restarting your shell. """) } diff --git a/Sources/Swiftly/Update.swift b/Sources/Swiftly/Update.swift index 9afb8666..2382bf43 100644 --- a/Sources/Swiftly/Update.swift +++ b/Sources/Swiftly/Update.swift @@ -138,7 +138,11 @@ struct Update: SwiftlyCommand { if pathChanged { SwiftlyCore.print(""" NOTE: Swiftly has updated some elements in your path and your shell may not yet be - aware of the changes. You can run 'hash -r' to update your shell. + aware of the changes. You can update your shell's environment by running + + hash -r + + or restarting your shell. """) } From f2227dc56c876d14111ac3c9e642a419d479d49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sun, 30 Mar 2025 15:35:03 +0200 Subject: [PATCH 5/7] Add introduction --- Sources/Swiftly/Init.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 35961bc1..37ba1b04 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -67,6 +67,12 @@ struct Init: SwiftlyCommand { // Give the user the prompt and the choice to abort at this point. if !assumeYes { var msg = """ + Welcome to swiftly, the Swift toolchain manager for Linux and macOS! + + Please read the following information carefully before proceeding with the installation. If you + wish to customize the steps performed during the installation process, refer to 'swiftly init -h' + for configuration options. + Swiftly installs files into the following locations: \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files From 7e225f58f1866ff197c8d5a1fb89dedb88b62d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sun, 30 Mar 2025 15:35:26 +0200 Subject: [PATCH 6/7] Mention modification of profile --- Sources/Swiftly/Init.swift | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 37ba1b04..53072f1b 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -86,17 +86,28 @@ struct Init: SwiftlyCommand { if !skipInstall { msg += """ - Once swiftly is set up, it will install the latest available Swift toolchain. - + Once swiftly is set up, it will install the latest available Swift toolchain. This can be + suppressed with the '--skip-install' option. """ #if os(Linux) msg += """ - In the process, swiftly will add swift.org GnuPG keys into your keychain to verify - the integrity of the downloads. + In the process, swiftly will add swift.org + GnuPG keys into your keychain to verify the integrity of the downloads. """ + #else + msg += "\n" #endif } + if !noModifyProfile { + msg += """ + + For your convenience, swiftly will also attempt to modify your shell's profile file to make + installed items available in your environment upon login. This can be suppressed with the + '--no-modify-profile' option. + + """ + } SwiftlyCore.print(msg) From 189ab8d1b9870d81facbe607e180b4713c7772b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Mon, 31 Mar 2025 18:10:22 +0200 Subject: [PATCH 7/7] Format code --- Sources/Swiftly/Init.swift | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index 53072f1b..d9c0efca 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -67,46 +67,46 @@ struct Init: SwiftlyCommand { // Give the user the prompt and the choice to abort at this point. if !assumeYes { var msg = """ - Welcome to swiftly, the Swift toolchain manager for Linux and macOS! + Welcome to swiftly, the Swift toolchain manager for Linux and macOS! - Please read the following information carefully before proceeding with the installation. If you - wish to customize the steps performed during the installation process, refer to 'swiftly init -h' - for configuration options. + Please read the following information carefully before proceeding with the installation. If you + wish to customize the steps performed during the installation process, refer to 'swiftly init -h' + for configuration options. - Swiftly installs files into the following locations: + Swiftly installs files into the following locations: - \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files - \(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain - \(Swiftly.currentPlatform.swiftlyToolchainsDir.path) - Directory hosting installed toolchains + \(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files + \(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain + \(Swiftly.currentPlatform.swiftlyToolchainsDir.path) - Directory hosting installed toolchains - These locations can be changed by setting the environment variables - SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again. + These locations can be changed by setting the environment variables + SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again. - """ + """ if !skipInstall { msg += """ - Once swiftly is set up, it will install the latest available Swift toolchain. This can be - suppressed with the '--skip-install' option. - """ - #if os(Linux) + Once swiftly is set up, it will install the latest available Swift toolchain. This can be + suppressed with the '--skip-install' option. + """ +#if os(Linux) msg += """ - In the process, swiftly will add swift.org - GnuPG keys into your keychain to verify the integrity of the downloads. + In the process, swiftly will add swift.org + GnuPG keys into your keychain to verify the integrity of the downloads. - """ - #else + """ +#else msg += "\n" - #endif +#endif } if !noModifyProfile { msg += """ - For your convenience, swiftly will also attempt to modify your shell's profile file to make - installed items available in your environment upon login. This can be suppressed with the - '--no-modify-profile' option. + For your convenience, swiftly will also attempt to modify your shell's profile file to make + installed items available in your environment upon login. This can be suppressed with the + '--no-modify-profile' option. - """ + """ } SwiftlyCore.print(msg)