From 41e26310a76e68147109bb83391848654c6c617d Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sun, 28 Sep 2025 22:09:29 +0200 Subject: [PATCH] Implemented the SampleAppParameters type in the sample app target, and integrated it to the SampleApp type. --- .../Parameters/SampleAppParameters.swift | 37 +++++++++++++++++++ Samples/DocCMiddleware/SampleApp.swift | 24 ++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 Samples/DocCMiddleware/Parameters/SampleAppParameters.swift create mode 100644 Samples/DocCMiddleware/SampleApp.swift diff --git a/Samples/DocCMiddleware/Parameters/SampleAppParameters.swift b/Samples/DocCMiddleware/Parameters/SampleAppParameters.swift new file mode 100644 index 0000000..acb4ae4 --- /dev/null +++ b/Samples/DocCMiddleware/Parameters/SampleAppParameters.swift @@ -0,0 +1,37 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the Hummingbird DocC Middleware open source project +// +// Copyright (c) 2025 Röck+Cöde VoF. and the Hummingbird DocC Middleware project authors +// Licensed under the EUPL 1.2 or later. +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of Hummingbird DocC Middleware project authors +// +// ===----------------------------------------------------------------------=== + +import protocol ArgumentParser.ParsableArguments + +import struct ArgumentParser.Option + +extension SampleApp { + /// A type that conforms to the `ParsableArguments` protocol, which contains the input parameters required for the execution of the sample executable. + struct Parameters: ParsableArguments { + + // MARK: Properties + + /// A label given to the sample app to identify it within a communications channel. + @Option( + name: .shortAndLong, + help: "A label given to the sample app for the sole purpose of identification within a communications channel." + ) + var hostname: String = "127.0.0.1" + + /// A port number assigned to the sample app from where the app either sends or receives data. + @Option( + name: .shortAndLong, + help: "A port number assigned to the sample app from where the app either sends or receives data." + ) + var port: Int = 8080 + } +} diff --git a/Samples/DocCMiddleware/SampleApp.swift b/Samples/DocCMiddleware/SampleApp.swift new file mode 100644 index 0000000..e8ca588 --- /dev/null +++ b/Samples/DocCMiddleware/SampleApp.swift @@ -0,0 +1,24 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the Hummingbird DocC Middleware open source project +// +// Copyright (c) 2025 Röck+Cöde VoF. and the Hummingbird DocC Middleware project authors +// Licensed under the EUPL 1.2 or later. +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of Hummingbird DocC Middleware project authors +// +// ===----------------------------------------------------------------------=== + +import struct ArgumentParser.OptionGroup + +/// A type that implements and runs the sample executable that showcases the `Hummingbird-DocC` middleware. +@main struct SampleApp { + + // MARK: Properties + + /// A type that contains all the necessary input parameters to run the sample executable. + @OptionGroup var parameters: Parameters + +} +