File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Examples/HelloWorldWithResources Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,15 @@ let package = Package(
22
22
dependencies: [
23
23
. package ( url: " https://github.com/hummingbird-project/hummingbird.git " , from: " 2.1.0 " ) ,
24
24
. package ( url: " https://github.com/apple/swift-container-plugin " , from: " 0.5.0 " ) ,
25
+ . package ( url: " https://github.com/apple/swift-argument-parser " , from: " 1.3.0 " ) ,
25
26
] ,
26
27
targets: [
27
28
. executableTarget(
28
29
name: " hello-world " ,
29
- dependencies: [ . product( name: " Hummingbird " , package : " hummingbird " ) ] ,
30
+ dependencies: [
31
+ . product( name: " Hummingbird " , package : " hummingbird " ) ,
32
+ . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
33
+ ] ,
30
34
resources: [ . process( " resources " ) ]
31
35
)
32
36
]
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ import ArgumentParser
16
+
15
17
@main
16
- struct Hello {
17
- static let hostname = " 0.0.0.0 "
18
- static let port = 8080
18
+ struct Hello : AsyncParsableCommand {
19
+ @Option ( name: . shortAndLong)
20
+ var hostname : String = " 0.0.0.0 "
21
+
22
+ @Option ( name: . shortAndLong)
23
+ var port : Int = 8080
19
24
20
- static func main ( ) async throws {
25
+ func run ( ) async throws {
21
26
let app = buildApplication (
22
27
configuration: . init(
23
28
address: . hostname( hostname, port: port) ,
You can’t perform that action at this time.
0 commit comments