Skip to content

Commit 80cc33c

Browse files
committed
Adopt @main
1 parent 6c907f3 commit 80cc33c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import SotoS3
33
import Logging
44
import libhostmgr
55

6+
@main
67
struct Hostmgr: ParsableCommand {
78

89
private static var appVersion = "0.14.2"
@@ -18,11 +19,22 @@ struct Hostmgr: ParsableCommand {
1819
SetCommand.self,
1920
BenchmarkCommand.self,
2021
ConfigCommand.self
21-
])
22-
}
22+
]
23+
)
24+
25+
mutating func run() throws {
26+
Logger.initializeLoggingSystem()
27+
28+
logger.trace("Starting Up")
2329

24-
Logger.initializeLoggingSystem()
25-
Hostmgr.main()
30+
guard Configuration.isValid else {
31+
print("Invalid configuration – exiting")
32+
throw ExitCode(1)
33+
}
34+
35+
throw CleanExit.helpRequest(self)
36+
}
37+
}
2638

2739
struct SetCommand: ParsableCommand {
2840
static let configuration = CommandConfiguration(

0 commit comments

Comments
 (0)