Adds aliases to the dump-help output. (#813)

This commit is contained in:
J Logan
2026-01-12 09:36:32 -08:00
committed by GitHub
parent 5d8546fff2
commit bbf95b73d9
6 changed files with 27 additions and 2 deletions
@@ -87,6 +87,7 @@ extension CommandInfoV0 {
superCommands: superCommands,
shouldDisplay: command.configuration.shouldDisplay,
commandName: command._commandName,
aliases: command.configuration.aliases,
abstract: command.configuration.abstract,
discussion: command.configuration.discussion,
defaultSubcommand: defaultSubcommand,
@@ -49,6 +49,8 @@ public struct CommandInfoV0: Codable, Hashable {
/// Name used to invoke the command.
public var commandName: String
/// List of command aliases.
public var aliases: [String]?
/// Short description of the command's functionality.
public var abstract: String?
/// Extended description of the command's functionality.
@@ -66,6 +68,7 @@ public struct CommandInfoV0: Codable, Hashable {
superCommands: [String],
shouldDisplay: Bool,
commandName: String,
aliases: [String]?,
abstract: String,
discussion: String,
defaultSubcommand: String?,
@@ -76,6 +79,7 @@ public struct CommandInfoV0: Codable, Hashable {
self.shouldDisplay = shouldDisplay
self.commandName = commandName
self.aliases = aliases?.nonEmpty
self.abstract = abstract.nonEmpty
self.discussion = discussion.nonEmpty
@@ -89,6 +93,8 @@ public struct CommandInfoV0: Codable, Hashable {
self.superCommands = try container.decodeIfPresent(
[String].self, forKey: .superCommands)
self.commandName = try container.decode(String.self, forKey: .commandName)
self.aliases = try container.decodeIfPresent(
[String].self, forKey: .aliases)
self.abstract = try container.decodeIfPresent(
String.self, forKey: .abstract)
self.discussion = try container.decodeIfPresent(
@@ -6,12 +6,18 @@
"parent1"
],
"commandName": "full-example",
"aliases": [
],
"abstract": "this command does everything",
"discussion": "like actually everything",
"defaultSubcommand": "do-thing",
"subcommands": [
{
"commandName": "sub"
"commandName": "sub",
"aliases": [
]
}
],
"arguments": [
@@ -63,6 +69,6 @@
"isRepeating": false,
"parsingStrategy" : "default",
}
]
],
}
}
@@ -134,6 +134,9 @@
},
{
"abstract" : "Print the product of the values.",
"aliases" : [
"mul"
],
"arguments" : [
{
"abstract" : "Use hexadecimal notation for the result.",
@@ -267,6 +270,9 @@
"subcommands" : [
{
"abstract" : "Print the average of the values.",
"aliases" : [
"avg"
],
"arguments" : [
{
"abstract" : "The kind of average to provide.",
@@ -1,6 +1,9 @@
{
"command" : {
"abstract" : "Print the product of the values.",
"aliases" : [
"mul"
],
"arguments" : [
{
"abstract" : "Use hexadecimal notation for the result.",
@@ -50,6 +50,9 @@
"subcommands" : [
{
"abstract" : "Print the average of the values.",
"aliases" : [
"avg"
],
"arguments" : [
{
"abstract" : "The kind of average to provide.",