Skip to content

Commit f283f8f

Browse files
committed
Makes ToolInfo aliases property optional.
1 parent a580e11 commit f283f8f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Sources/ArgumentParserToolInfo/ToolInfo.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public struct CommandInfoV0: Codable, Hashable {
5050
/// Name used to invoke the command.
5151
public var commandName: String
5252
/// List of command aliases.
53-
public var aliases: [String]
53+
public var aliases: [String]?
5454
/// Short description of the command's functionality.
5555
public var abstract: String?
5656
/// Extended description of the command's functionality.
@@ -68,7 +68,7 @@ public struct CommandInfoV0: Codable, Hashable {
6868
superCommands: [String],
6969
shouldDisplay: Bool,
7070
commandName: String,
71-
aliases: [String],
71+
aliases: [String]?,
7272
abstract: String,
7373
discussion: String,
7474
defaultSubcommand: String?,
@@ -93,7 +93,7 @@ public struct CommandInfoV0: Codable, Hashable {
9393
self.superCommands = try container.decodeIfPresent(
9494
[String].self, forKey: .superCommands)
9595
self.commandName = try container.decode(String.self, forKey: .commandName)
96-
self.aliases = try container.decode([String].self, forKey: .aliases)
96+
self.aliases = try container.decodeIfPresent([String].self, forKey: .aliases)
9797
self.abstract = try container.decodeIfPresent(
9898
String.self, forKey: .abstract)
9999
self.discussion = try container.decodeIfPresent(
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"serializationVersion": 0,
33
"command": {
4-
"commandName": "empty-example",
5-
"aliases": [
6-
7-
]
4+
"commandName": "empty-example"
85
}
96
}

0 commit comments

Comments
 (0)