Skip to content

Commit 4d2be90

Browse files
authored
Remove code the compiler can generate on its own. Removed public annotations nested inside internal types. (#22)
1 parent 4989394 commit 4d2be90

File tree

3 files changed

+7
-47
lines changed

3 files changed

+7
-47
lines changed

Sources/ArgumentParser/Parsing/Name.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ enum Name: Equatable {
2929
self = .longWithSingleDash(String(baseName.dropFirst()))
3030
}
3131
}
32-
33-
static func == (lhs: Name, rhs: Name) -> Bool {
34-
switch (lhs, rhs) {
35-
case (.long(let lhs), .long(let rhs)):
36-
return lhs == rhs
37-
case (.short(let lhs), .short(let rhs)):
38-
return lhs == rhs
39-
case (.longWithSingleDash(let lhs), .longWithSingleDash(let rhs)):
40-
return lhs == rhs
41-
default:
42-
return false
43-
}
44-
}
4532
}
4633

4734
extension Name {

Sources/ArgumentParser/Parsing/ParsedValues.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ struct ParsedValues {
4141
///
4242
/// This is used for error output generation.
4343
var originalInput: [String]
44-
45-
public init(elements: [Element] = [], originalInput: [String]) {
46-
self.elements = elements
47-
self.originalInput = originalInput
48-
}
4944
}
5045

5146
enum LenientParsedValues {

Sources/ArgumentParser/Usage/HelpGenerator.swift

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ internal struct HelpGenerator {
1919
internal static var _screenWidthOverride: Int? = nil
2020

2121
struct Usage {
22-
public var components: [String]
23-
24-
public init(components: [String]) {
25-
self.components = components
26-
}
22+
var components: [String]
2723

2824
var rendered: String {
2925
components
@@ -33,15 +29,9 @@ internal struct HelpGenerator {
3329

3430
struct Section {
3531
struct Element {
36-
public var label: String
37-
public var abstract: String
38-
public var discussion: String
39-
40-
public init(label: String, abstract: String = "", discussion: String = "") {
41-
self.label = label
42-
self.abstract = abstract
43-
self.discussion = discussion
44-
}
32+
var label: String
33+
var abstract: String = ""
34+
var discussion: String = ""
4535

4636
var paddedLabel: String {
4737
String(repeating: " ", count: HelpGenerator.helpIndent) + label
@@ -86,15 +76,8 @@ internal struct HelpGenerator {
8676

8777
var header: Header
8878
var elements: [Element]
89-
var discussion: String
90-
var isSubcommands: Bool
91-
92-
init(header: Header, elements: [Element], discussion: String = "", isSubcommands: Bool = false) {
93-
self.header = header
94-
self.elements = elements
95-
self.discussion = discussion
96-
self.isSubcommands = isSubcommands
97-
}
79+
var discussion: String = ""
80+
var isSubcommands: Bool = false
9881

9982
var rendered: String {
10083
guard !elements.isEmpty else { return "" }
@@ -106,13 +89,8 @@ internal struct HelpGenerator {
10689
}
10790

10891
struct DiscussionSection {
109-
var title: String
92+
var title: String = ""
11093
var content: String
111-
112-
init(title: String = "", content: String) {
113-
self.title = title
114-
self.content = content
115-
}
11694
}
11795

11896
var abstract: String

0 commit comments

Comments
 (0)