@@ -47,7 +47,7 @@ enum HelpTopic: ExpressibleByArgument, CustomStringConvertible {
47
47
}
48
48
49
49
enum Subcommand : String , CaseIterable {
50
- case build, package , run, test
50
+ case build, package , run, test, repl
51
51
52
52
var description : String {
53
53
switch self {
@@ -59,6 +59,8 @@ enum Subcommand: String, CaseIterable {
59
59
return " Run a program from a package "
60
60
case . test:
61
61
return " Run package tests "
62
+ case . repl:
63
+ return " Experiment with Swift code interactively "
62
64
}
63
65
}
64
66
}
@@ -111,12 +113,6 @@ struct SwiftHelp: ParsableCommand {
111
113
print ( " \( plainBold) swift \( command. rawValue) \( plain) \( padding) \( command. description) " )
112
114
}
113
115
114
- // `repl` not included in `Subcommand`, also print it here.
115
- do {
116
- let padding = String ( repeating: " " , count: maxSubcommandNameLength - " repl " . count)
117
- print ( " \( plainBold) swift repl \( plain) \( padding) Experiment with Swift code interactively " )
118
- }
119
-
120
116
print ( " \n Use \( plainBold) `swift --version` \( plain) for Swift version information. " )
121
117
print ( " \n Use \( plainBold) `swift --help` \( plain) for descriptions of available options and flags. " )
122
118
print ( " \n Use \( plainBold) `swift help <subcommand>` \( plain) for more information about a subcommand. " )
@@ -131,6 +127,16 @@ struct SwiftHelp: ParsableCommand {
131
127
if kind == . interactive {
132
128
printIntro ( )
133
129
}
130
+ case . subcommand( . repl) :
131
+ print ( """
132
+ USAGE: swift repl <options>
133
+
134
+ The Swift REPL runs code interactively with LLDB.
135
+ For most purposes, you can just run `swift repl`.
136
+
137
+ OPTIONS:
138
+ This mode takes optional Swift Frontend arguments: see `swift --help`.
139
+ """ )
134
140
case . subcommand( let subcommand) :
135
141
// Try to find the subcommand adjacent to the help tool.
136
142
// If we didn't find the tool there, let the OS search for it.
0 commit comments