1/// What `covane history` was asked to do, read from the arguments after the command word.
2public struct HistoryOptions: Sendable, Equatable {
3 public static let commandWord = "history"
4
5 public static let usage = """
6 usage: covane history --runs <folder of <commit>/totals.json> --output <page.html>
7 [--title <text>]
8 """
9
10 /// The folder whose subfolders are one run each (DESIGN.md D7).
11 public let runsFolder: String
12 /// The page to write; `report.css` goes beside it.
13 public let outputPath: String
14 public let title: String
15
16 /// - Throws: `ReportOptionsError` for an unknown option, an option without its value
17 /// or a missing required option.
185 public init(arguments: [String]) throws {
195 let values = try OptionValues(arguments: arguments, allowed: Self.options)
203 runsFolder = try values.required("--runs")
213 outputPath = try values.required("--output")
222 title = values["--title"] ?? ReportOptions.defaultTitle
232 }
24
25 private static let options: Set = ["--runs", "--output", "--title"]
26}