From 2fab25898415483b49aeadff333dd4e2804288ff Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sat, 9 Dec 2023 20:49:26 -0700 Subject: fix \t\t --- Sources/gopherHandler.swift | 6 +++--- Sources/server.swift | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Sources/gopherHandler.swift b/Sources/gopherHandler.swift index fb2c4c7..00a3a30 100644 --- a/Sources/gopherHandler.swift +++ b/Sources/gopherHandler.swift @@ -79,7 +79,7 @@ final class GopherHandler: ChannelInboundHandler { return .string(fileContents) } catch { logger.error("Error reading file: \(path.path) Error: \(error)") - return .string("3Error reading file...\terror.host\t1\r\n") + return .string("3Error reading file...\t\terror.host\t1\r\n") } } else { // Handle binary file @@ -88,14 +88,14 @@ final class GopherHandler: ChannelInboundHandler { return .data(fileContents) } catch { logger.error("Error reading binary file: \(path.path) Error: \(error)") - return .string("3Error reading file...\terror.host\t1\r\n") + return .string("3Error reading file...\t\terror.host\t1\r\n") } } } } else { logger.error("Error reading directory: \(path.path) Directory does not exist.") - return .string("3Error reading file...\terror.host\t1\r\n") + return .string("3Error reading file...\t\terror.host\t1\r\n") } } diff --git a/Sources/server.swift b/Sources/server.swift index 44520bb..c8cf97b 100644 --- a/Sources/server.swift +++ b/Sources/server.swift @@ -8,12 +8,18 @@ import NIO @main struct swiftGopher: ParsableCommand { - @Option var gopherHostName: String = "localhost" - @Option var port: Int = 8080 - @Option var gopherDataDir: String = "./example-gopherdata" - @Option var host: String = "0.0.0.0" - @Flag var disableSearch: Bool = false - @Flag var disableGophermap: Bool = false + @Option(name: [.short, .long], help: "Hostname used for generating selectors") + var gopherHostName: String = "localhost" + @Option(name: [.short, .long]) + var host: String = "0.0.0.0" + @Option(name: [.short, .long]) + var port: Int = 8080 + @Option(name: [.customShort("d"), .long], help: "Data directory to map") + var gopherDataDir: String = "./example-gopherdata" + @Flag(help: "Disable full-text search feature") + var disableSearch: Bool = false + @Flag(help: "Disable reading gophermap files to override automatic generation") + var disableGophermap: Bool = false public mutating func run() throws { let eventLoopGroup = MultiThreadedEventLoopGroup( -- cgit v1.2.3