Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions Sources/Swiftly/Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 { "" }
var msg = """
Swiftly installs files into the following locations:

SwiftlyCore.print("""
Swiftly will be installed 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) - Data and configuration files directory including toolchains
\(Swiftly.currentPlatform.swiftlyBinDir.path) - Executables installation directory
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 with SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables and run this again.
\(installMsg)
""")
"""
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Since you're making this summary much better than what was there before can you also put in a section that describes the changes to the user's profile? This was something being asked in #255 . This summary is trying to gain user trust through transparency, so that they don't just hit n / ctrl-c.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's done now. The logic is as before: When suppressing commands are not given, the text is printed to let the user know about this significant change. It now also mentions the command line option that'd suppress it right away.

}

SwiftlyCore.print(msg)

guard SwiftlyCore.promptForConfirmation(defaultBehavior: true) else {
throw SwiftlyError(message: "swiftly installation has been cancelled")
Expand Down Expand Up @@ -239,9 +248,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.

""")
}
Expand Down
6 changes: 2 additions & 4 deletions Sources/Swiftly/Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Can the command go onto its own line here? While the indentation is not very consistent at the moment, the idea is to have each command the user is being asked to run on separate lines so that they can select, copy, paste, and run up them more easily than trying to select from inside a paragraph.

Copy link
Contributor Author

@SimplyDanny SimplyDanny Mar 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made it so that the command is on a separate line easy to copy and added the info that restarting the shell is an option, too. I personally like it when the reading flow isn't interrupted by colons only to name things.


""")
}
Expand Down
6 changes: 2 additions & 4 deletions Sources/Swiftly/Update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.

""")
}
Expand Down