Skip to content

Commit 5f33a61

Browse files
committed
swift-java: print the complete invocation args, to help debugging when
validation failed
1 parent 951bb25 commit 5f33a61

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Sources/SwiftJavaTool/SwiftJava.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ struct SwiftJava: AsyncParsableCommand {
3939
JExtractCommand.self
4040
])
4141

42+
public static func main() async {
43+
do {
44+
var command = try parseAsRoot(nil)
45+
if var asyncCommand = command as? AsyncParsableCommand {
46+
try await asyncCommand.run()
47+
} else {
48+
try command.run()
49+
}
50+
} catch {
51+
print("Invocation: \(CommandLine.arguments.joined(separator: " "))")
52+
exit(withError: error)
53+
}
54+
}
55+
4256
mutating func run() async throws {
4357
guard CommandLine.arguments.count >= 2 else {
4458
// there's no "default" command, print USAGE when no arguments/parameters are passed.

0 commit comments

Comments
 (0)