Documented the App and its AppOptions types in the app target.
This commit is contained in:
parent
3ee7878c02
commit
b97c19f972
@ -1,14 +1,17 @@
|
|||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import DoxyLibrary
|
import DoxyLibrary
|
||||||
|
|
||||||
|
/// A command type that runs the service based on given of set of option parameters.
|
||||||
@main struct Doxy: AsyncParsableCommand {
|
@main struct Doxy: AsyncParsableCommand {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// An option type that contains all the possible parameters that can be provided to the service.
|
||||||
@OptionGroup var options: Options
|
@OptionGroup var options: Options
|
||||||
|
|
||||||
// MARK: Functions
|
// MARK: Functions
|
||||||
|
|
||||||
|
/// Runs the service.
|
||||||
mutating func run() async throws {
|
mutating func run() async throws {
|
||||||
let appBuilder = AppBuilder(
|
let appBuilder = AppBuilder(
|
||||||
name: options.name,
|
name: options.name,
|
||||||
|
@ -3,34 +3,40 @@ import DoxyLibrary
|
|||||||
import Logging
|
import Logging
|
||||||
|
|
||||||
extension Doxy {
|
extension Doxy {
|
||||||
|
/// An option type that contains all the possible parameters that can be provided to the application.
|
||||||
struct Options: AppArguments, ParsableArguments {
|
struct Options: AppArguments, ParsableArguments {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A path to the location of the DocC archives in the local file system.
|
||||||
@Option(
|
@Option(
|
||||||
name: .shortAndLong,
|
name: .shortAndLong,
|
||||||
help: "A path to the location of the DocC archives in the local file system."
|
help: "A path to the location of the DocC archives in the local file system. Defaults to `Resources/Archives`."
|
||||||
)
|
)
|
||||||
var archivesPath: String = "Resources/Archives"
|
var archivesPath: String = "Resources/Archives"
|
||||||
|
|
||||||
|
/// A hostname to bind the application to.
|
||||||
@Option(
|
@Option(
|
||||||
name: .shortAndLong,
|
name: .shortAndLong,
|
||||||
help: "A hostname to bind the application to. Defaults to `127.0.0.1`."
|
help: "A hostname to bind the application to. Defaults to `127.0.0.1`."
|
||||||
)
|
)
|
||||||
var hostname: String = "127.0.0.1"
|
var hostname: String = "127.0.0.1"
|
||||||
|
|
||||||
|
/// A log level to set the logger service in the application.
|
||||||
@Option(
|
@Option(
|
||||||
name: .shortAndLong,
|
name: .shortAndLong,
|
||||||
help: "A log level to set the logger service in the application."
|
help: "A log level to set the logger service in the application."
|
||||||
)
|
)
|
||||||
var logLevel: Logger.Level?
|
var logLevel: Logger.Level?
|
||||||
|
|
||||||
|
/// A name for the Hummingbird application.
|
||||||
@Option(
|
@Option(
|
||||||
name: .shortAndLong,
|
name: .shortAndLong,
|
||||||
help: "A name for the Hummingbird application."
|
help: "A name for the Hummingbird application. Defaults to `Doxy`."
|
||||||
)
|
)
|
||||||
var name: String = "Doxy"
|
var name: String = "Doxy"
|
||||||
|
|
||||||
|
/// A port number to bind the application to.
|
||||||
@Option(
|
@Option(
|
||||||
name: .shortAndLong,
|
name: .shortAndLong,
|
||||||
help: "A port number to bind the application to. Defaults to `8080`."
|
help: "A port number to bind the application to. Defaults to `8080`."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user