Add newlines to gensite errors

This commit is contained in:
Sami Samhuri 2023-03-03 09:03:56 -08:00
parent 93a9f5b403
commit 9e7bbcab5a
No known key found for this signature in database
GPG key ID: 4B4195422742FC16

View file

@ -10,7 +10,7 @@ import samhuri_net
guard CommandLine.arguments.count >= 3 else {
let name = CommandLine.arguments[0]
fputs("Usage: \(name) <site dir> <target dir>", stderr)
fputs("Usage: \(name) <site dir> <target dir>\n", stderr)
exit(1)
}
@ -18,7 +18,7 @@ let sourcePath = CommandLine.arguments[1]
var isDir: ObjCBool = false
let sourceExists = FileManager.default.fileExists(atPath: sourcePath, isDirectory: &isDir)
guard sourceExists, isDir.boolValue else {
fputs("error: Site path \(sourcePath) does not exist or is not a directory", stderr)
fputs("error: Site path \(sourcePath) does not exist or is not a directory\n", stderr)
exit(2)
}
@ -28,7 +28,7 @@ let siteURLOverride: URL?
if CommandLine.argc > 3, CommandLine.arguments[3].isEmpty == false {
let urlString = CommandLine.arguments[3]
guard let url = URL(string: urlString) else {
print("error: invalid site URL \(urlString)")
fputs("error: invalid site URL \(urlString)\n", stderr)
exit(4)
}
siteURLOverride = url
@ -45,6 +45,6 @@ do {
exit(0)
}
catch {
fputs("error: \(error)", stderr)
fputs("error: \(error)\n", stderr)
exit(-1)
}