Added the "archivesPath" and the "name" properties to the AppArguments protocol in the library target.

This commit is contained in:
Javier Cicchelli 2025-03-26 00:26:57 +01:00
parent 1f81286a8b
commit f9fc29c8da
3 changed files with 26 additions and 4 deletions

View File

@ -7,6 +7,12 @@ extension App {
// 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`."
@ -19,6 +25,12 @@ extension App {
)
var logLevel: Logger.Level?
@Option(
name: .shortAndLong,
help: "A name for the Hummingbird application."
)
var name: String = "Doxy"
@Option(
name: .shortAndLong,
help: "A port number to bind the application to. Defaults to `8080`."

View File

@ -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 }

View File

@ -5,6 +5,8 @@ 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