diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2023-12-09 20:49:26 -0700 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2023-12-09 20:49:26 -0700 |
commit | 2fab25898415483b49aeadff333dd4e2804288ff (patch) | |
tree | a829107dc23e01d84240a566c68504862a1ec6bc | |
parent | 6e7efbe9092b9d5b6618a5174166ea96f9989d78 (diff) |
fix \t\t
-rw-r--r-- | Sources/gopherHandler.swift | 6 | ||||
-rw-r--r-- | 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( |