Skip to content

Commit 0d6e4a8

Browse files
committed
Update help to use multiline strings.
1 parent da27442 commit 0d6e4a8

File tree

1 file changed

+42
-43
lines changed

1 file changed

+42
-43
lines changed

Sources/protoc-gen-swift/main.swift

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -79,52 +79,51 @@ struct GeneratorPlugin {
7979
}
8080

8181
private func showHelp() {
82-
print("\(CommandLine.programName): Convert parsed proto definitions into Swift")
83-
print("")
84-
showVersion()
85-
print(Version.copyright)
86-
print("")
87-
8882
let version = SwiftProtobuf.Version.self
8983
let packageVersion = "\(version.major),\(version.minor),\(version.revision)"
9084

91-
let help = (
92-
"Note: This is a plugin for protoc and should not normally be run\n"
93-
+ "directly.\n"
94-
+ "\n"
95-
+ "If you invoke a recent version of protoc with the --swift_out=<dir>\n"
96-
+ "option, then protoc will search the current PATH for protoc-gen-swift\n"
97-
+ "and use it to generate Swift output.\n"
98-
+ "\n"
99-
+ "In particular, if you have renamed this program, you will need to\n"
100-
+ "adjust the protoc command-line option accordingly.\n"
101-
+ "\n"
102-
+ "The generated Swift output requires the SwiftProtobuf \(SwiftProtobuf.Version.versionString)\n"
103-
+ "library be included in your project.\n"
104-
+ "\n"
105-
+ "If you use `swift build` to compile your project, add this to\n"
106-
+ "Package.swift:\n"
107-
+ "\n"
108-
+ " dependencies: [\n"
109-
+ " .package(name: \"SwiftProtobuf\", url: \"https://github.com/apple/swift-protobuf.git\", from: \"\(packageVersion)\"),"
110-
+ " ]\n"
111-
+ "\n"
112-
+ "\n"
113-
+ "Usage: \(CommandLine.programName) [options] [filename...]\n"
114-
+ "\n"
115-
+ " -h|--help: Print this help message\n"
116-
+ " --version: Print the program version\n"
117-
+ "\n"
118-
+ "Filenames specified on the command line indicate binary-encoded\n"
119-
+ "google.protobuf.compiler.CodeGeneratorRequest objects that will\n"
120-
+ "be read and converted to Swift source code. The source text will be\n"
121-
+ "written directly to stdout.\n"
122-
+ "\n"
123-
+ "When invoked with no filenames, it will read a single binary-encoded\n"
124-
+ "google.protobuf.compiler.CodeGeneratorRequest object from stdin and\n"
125-
+ "emit the corresponding CodeGeneratorResponse object to stdout.\n")
126-
127-
print(help)
85+
print("""
86+
\(CommandLine.programName): Convert parsed proto definitions into Swift
87+
88+
""")
89+
showVersion()
90+
print("""
91+
\(Version.copyright)
92+
93+
Note: This is a plugin for protoc and should not normally be run
94+
directly.
95+
96+
If you invoke a recent version of protoc with the --swift_out=<dir>
97+
option, then protoc will search the current PATH for protoc-gen-swift
98+
and use it to generate Swift output.
99+
100+
In particular, if you have renamed this program, you will need to
101+
adjust the protoc command-line option accordingly.
102+
103+
The generated Swift output requires the SwiftProtobuf \(SwiftProtobuf.Version.versionString)
104+
library be included in your project.
105+
106+
If you use `swift build` to compile your project, add this to
107+
Package.swift:
108+
109+
dependencies: [
110+
.package(name: "SwiftProtobuf", url: "https://github.com/apple/swift-protobuf.git", from: "\(packageVersion)"),
111+
]
112+
113+
Usage: \(CommandLine.programName) [options] [filename...]
114+
115+
-h|--help: Print this help message
116+
--version: Print the program version
117+
118+
Filenames specified on the command line indicate binary-encoded
119+
google.protobuf.compiler.CodeGeneratorRequest objects that will
120+
be read and converted to Swift source code. The source text will be
121+
written directly to stdout.
122+
123+
When invoked with no filenames, it will read a single binary-encoded
124+
google.protobuf.compiler.CodeGeneratorRequest object from stdin and
125+
emit the corresponding CodeGeneratorResponse object to stdout.
126+
""")
128127
}
129128

130129
private func showVersion() {

0 commit comments

Comments
 (0)