1/// What `covane unavailable` was asked to do, read from the arguments after the command
2/// word.
3public struct UnavailableOptions: Sendable, Equatable {
4 public static let commandWord = "unavailable"
5
6 public static let usage = """
7 usage: covane unavailable --output <site folder> --reason <text>
8 [--title <text>] [--commit <sha>] [--subject <text>]
9 """
10
11 /// The folder to write the run's files to, as `--output` of a normal run.
12 public let outputFolder: String
13 /// Why the run has no coverage, such as "Package tests failed". Untrusted text.
14 public let reason: String
15 public let title: String
16 public let commit: String?
17 public let subject: String?
18
19 /// - Throws: `ReportOptionsError` for an unknown option, an option without its value
20 /// or a missing required option.
216 public init(arguments: [String]) throws {
226 let values = try OptionValues(arguments: arguments, allowed: Self.options)
234 outputFolder = try values.required("--output")
243 reason = try values.required("--reason")
252 title = values["--title"] ?? ReportOptions.defaultTitle
262 commit = values["--commit"]
272 subject = values["--subject"]
282 }
29
30 private static let options: Set = ["--output", "--reason", "--title", "--commit", "--subject"]
31}