Skip to content

Commit 7e4e9c4

Browse files
fix: various changes
1 parent d7f9478 commit 7e4e9c4

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/markdown/command.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class MarkdownCommand extends MarkdownBase {
3535
private state: unknown;
3636
private deprecated: boolean;
3737
private deprecationDetails: { version?: string; to?: string } | null;
38+
private aliases: string[];
3839

3940
public constructor(
4041
topic: string,
@@ -90,6 +91,7 @@ export class MarkdownCommand extends MarkdownBase {
9091
this.deprecated = (command.deprecated as boolean) ?? this.state === 'deprecated' ?? false;
9192
const dep = command.deprecated;
9293
this.deprecationDetails = dep && typeof dep === 'object' ? (dep as { version?: string; to?: string }) : null;
94+
this.aliases = command.aliases ?? [];
9395
}
9496

9597
protected async generate(): Promise<string> {
@@ -116,7 +118,7 @@ export class MarkdownCommand extends MarkdownBase {
116118
}
117119

118120
if (this.help.length > 0) {
119-
lines.push(`## Description for ${this.commandName}`);
121+
lines.push(`## Description for "${this.commandName}"`);
120122
lines.push('');
121123
for (const paragraph of convertHyphenListsToMarkdown(
122124
this.help.map((p) => applyCodeFormatting(escapeAngleBrackets(p)))
@@ -126,6 +128,15 @@ export class MarkdownCommand extends MarkdownBase {
126128
}
127129
}
128130

131+
if (this.aliases.length > 0) {
132+
lines.push(`## Aliases for "${this.commandName}"`);
133+
lines.push('');
134+
for (const alias of this.aliases) {
135+
lines.push(`\`${alias}\``);
136+
lines.push('');
137+
}
138+
}
139+
129140
if (parameters.length > 0) {
130141
lines.push('## Flags');
131142
lines.push('');
@@ -141,7 +152,7 @@ export class MarkdownCommand extends MarkdownBase {
141152
}
142153

143154
if (this.examples.length > 0) {
144-
lines.push(`## Examples for ${this.commandName}`);
155+
lines.push(`## Examples for "${this.commandName}"`);
145156
lines.push('');
146157
for (const example of this.examples) {
147158
if (example.description) {

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { AnyJson } from '@salesforce/ts-types';
2121

2222
export type CommandClass = Pick<
2323
Command.Class,
24-
'id' | 'hidden' | 'description' | 'plugin' | 'state' | 'examples' | 'summary' | 'flags' | 'pluginName'
24+
'id' | 'hidden' | 'description' | 'plugin' | 'state' | 'examples' | 'summary' | 'flags' | 'pluginName' | 'aliases'
2525
> & { topic: string; subtopic: string; longDescription?: string; binary: string; deprecated?: boolean };
2626

2727
export const events = new EventEmitter();

0 commit comments

Comments
 (0)