From f9fc29c8da899bf978cd892be52f7223acbdcafb Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Wed, 26 Mar 2025 00:26:57 +0100 Subject: [PATCH] Added the "archivesPath" and the "name" properties to the AppArguments protocol in the library target. --- App/Sources/Options/AppOptions.swift | 14 +++++++++++++- .../Sources/Public/Protocols/AppArguments.swift | 10 +++++++++- Test/Sources/Helpers/Models/TestArguments.swift | 6 ++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/App/Sources/Options/AppOptions.swift b/App/Sources/Options/AppOptions.swift index edd61bf..a107f02 100644 --- a/App/Sources/Options/AppOptions.swift +++ b/App/Sources/Options/AppOptions.swift @@ -4,9 +4,15 @@ import Logging extension App { struct Options: AppArguments, ParsableArguments { - + // MARK: Properties + @Option( + name: .shortAndLong, + help: "A path to the location of the DocC archives in the local file system." + ) + var archivesPath: String = "Resources/Archives" + @Option( name: .shortAndLong, help: "A hostname to bind the application to. Defaults to `127.0.0.1`." @@ -18,6 +24,12 @@ extension App { help: "A log level to set the logger service in the application." ) var logLevel: Logger.Level? + + @Option( + name: .shortAndLong, + help: "A name for the Hummingbird application." + ) + var name: String = "Doxy" @Option( name: .shortAndLong, diff --git a/Library/Sources/Public/Protocols/AppArguments.swift b/Library/Sources/Public/Protocols/AppArguments.swift index 37b803c..362757a 100644 --- a/Library/Sources/Public/Protocols/AppArguments.swift +++ b/Library/Sources/Public/Protocols/AppArguments.swift @@ -1,14 +1,22 @@ import Logging -/// A type that defines the input arguments that the `Hummingbird`app receives. +/// A protocol that defines the input arguments an application receives from the command line. public protocol AppArguments { // MARK: Properties + /// A path to the location of the DocC archives in the local file system. + var archivesPath: String { get } + /// A bind address for the app. var hostname: String { get } + /// A logging level to configure for the app. var logLevel: Logger.Level? { get } + + /// A name for the app. + var name: String { get } + /// A port for the app to use, var port: Int { get } diff --git a/Test/Sources/Helpers/Models/TestArguments.swift b/Test/Sources/Helpers/Models/TestArguments.swift index 6d77355..f5e336e 100644 --- a/Test/Sources/Helpers/Models/TestArguments.swift +++ b/Test/Sources/Helpers/Models/TestArguments.swift @@ -2,9 +2,11 @@ import DoxyLibrary import Logging struct TestArguments: AppArguments { - + // MARK: Properties - + + let name = "DoxyTest" + let archivesPath = "Resources/Archives/Test" let hostname = "127.0.0.1" let logLevel: Logger.Level? = .trace let port = 0