Skip to content

Commit fd32a53

Browse files
authored
Polish welcome message (#273)
* List toolchain location and restructure message concatenation * Add introduction * Mention modification of profile
1 parent b5bd396 commit fd32a53

File tree

3 files changed

+54
-20
lines changed

3 files changed

+54
-20
lines changed

Sources/Swiftly/Init.swift

+44-14
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,50 @@ struct Init: SwiftlyCommand {
6666

6767
// Give the user the prompt and the choice to abort at this point.
6868
if !assumeYes {
69+
var msg = """
70+
Welcome to swiftly, the Swift toolchain manager for Linux and macOS!
71+
72+
Please read the following information carefully before proceeding with the installation. If you
73+
wish to customize the steps performed during the installation process, refer to 'swiftly init -h'
74+
for configuration options.
75+
76+
Swiftly installs files into the following locations:
77+
78+
\(Swiftly.currentPlatform.swiftlyHomeDir.path) - Directory for configuration files
79+
\(Swiftly.currentPlatform.swiftlyBinDir.path) - Links to the binaries of the active toolchain
80+
\(Swiftly.currentPlatform.swiftlyToolchainsDir.path) - Directory hosting installed toolchains
81+
82+
These locations can be changed by setting the environment variables
83+
SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR before running 'swiftly init' again.
84+
85+
"""
86+
if !skipInstall {
87+
msg += """
88+
89+
Once swiftly is set up, it will install the latest available Swift toolchain. This can be
90+
suppressed with the '--skip-install' option.
91+
"""
6992
#if os(Linux)
70-
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."
93+
msg += """
94+
In the process, swiftly will add swift.org
95+
GnuPG keys into your keychain to verify the integrity of the downloads.
96+
97+
"""
7198
#else
72-
let sigMsg = ""
99+
msg += "\n"
73100
#endif
74-
let installMsg = if !skipInstall {
75-
"\nOnce swiftly is installed it will install the latest available swift toolchain.\(sigMsg)\n"
76-
} else { "" }
101+
}
102+
if !noModifyProfile {
103+
msg += """
77104
78-
SwiftlyCore.print("""
79-
Swiftly will be installed into the following locations:
105+
For your convenience, swiftly will also attempt to modify your shell's profile file to make
106+
installed items available in your environment upon login. This can be suppressed with the
107+
'--no-modify-profile' option.
80108
81-
\(Swiftly.currentPlatform.swiftlyHomeDir.path) - Data and configuration files directory including toolchains
82-
\(Swiftly.currentPlatform.swiftlyBinDir.path) - Executables installation directory
109+
"""
110+
}
83111

84-
These locations can be changed with SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables and run this again.
85-
\(installMsg)
86-
""")
112+
SwiftlyCore.print(msg)
87113

88114
guard SwiftlyCore.promptForConfirmation(defaultBehavior: true) else {
89115
throw SwiftlyError(message: "swiftly installation has been cancelled")
@@ -239,9 +265,13 @@ struct Init: SwiftlyCommand {
239265
// Fish doesn't have path caching, so this might only be needed for bash/zsh
240266
if pathChanged && !quietShellFollowup && !shell.hasSuffix("fish") {
241267
SwiftlyCore.print("""
242-
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.
268+
Your shell caches items on your path for better performance. Swiftly has added
269+
items to your path that may not get picked up right away. You can update your
270+
shell's environment by running
271+
272+
hash -r
243273
244-
hash -r
274+
or restarting your shell.
245275
246276
""")
247277
}

Sources/Swiftly/Install.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ struct Install: SwiftlyCommand {
112112
// Fish doesn't cache its path, so this instruction is not necessary.
113113
if pathChanged && !shell.hasSuffix("fish") {
114114
SwiftlyCore.print("""
115-
NOTE: We have updated some elements in your path and your shell may not yet be
116-
aware of the changes. You can run this command to update your shell.
115+
NOTE: Swiftly has updated some elements in your path and your shell may not yet be
116+
aware of the changes. You can update your shell's environment by running
117117
118-
hash -r
118+
hash -r
119+
120+
or restarting your shell.
119121
120122
""")
121123
}

Sources/Swiftly/Update.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ struct Update: SwiftlyCommand {
137137

138138
if pathChanged {
139139
SwiftlyCore.print("""
140-
NOTE: We have updated some elements in your path and your shell may not yet be
141-
aware of the changes. You can run this command to update your shell.
140+
NOTE: Swiftly has updated some elements in your path and your shell may not yet be
141+
aware of the changes. You can update your shell's environment by running
142142
143-
hash -r
143+
hash -r
144+
145+
or restarting your shell.
144146
145147
""")
146148
}

0 commit comments

Comments
 (0)