Skip to content

Commit ecf8fb2

Browse files
authored
feat: add --all (#38)
1 parent 09a4976 commit ecf8fb2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

messages/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"commandDescription": "generate the command reference guide located",
33
"pluginFlagDescription": "comma separated list of plugin names to be part of the generation. Defaults to the oclif plugin in the current working directory",
4+
"allFlagDescription": "include all relevant plugins in the generation",
45
"hiddenFlagDescription": "show hidden commands",
56
"outputdirFlagDescription": "output directory to put generated files",
67
"erroronwarningFlagDescription": "fail the command if there are any warnings",

src/commands/commandreference/generate.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export default class CommandReferenceGenerate extends SfCommand<AnyJson> {
3535
char: 'p',
3636
description: messages.getMessage('pluginFlagDescription'),
3737
multiple: true,
38+
exclusive: ['all'],
39+
}),
40+
all: Flags.boolean({
41+
char: 'a',
42+
description: messages.getMessage('allFlagDescription'),
43+
exclusive: ['plugins'],
3844
}),
3945
'ditamap-suffix': Flags.string({
4046
char: 's',
@@ -51,7 +57,7 @@ export default class CommandReferenceGenerate extends SfCommand<AnyJson> {
5157
Ditamap.suffix = flags['ditamap-suffix'];
5258

5359
let pluginNames: string[];
54-
if (!flags.plugins) {
60+
if (!flags.plugins && !flags.all) {
5561
const pJsonPath = path.join(process.cwd(), 'package.json');
5662
if (await fs.fileExists(pJsonPath)) {
5763
const packageJson = await fs.readJson(pJsonPath);
@@ -61,6 +67,14 @@ export default class CommandReferenceGenerate extends SfCommand<AnyJson> {
6167
"No plugins provided. Provide the '--plugins' flag or cd into a directory that contains a valid oclif plugin."
6268
);
6369
}
70+
} else if (flags.all) {
71+
const ignore = [
72+
/@oclif/,
73+
/@salesforce\/cli/,
74+
/@salesforce\/plugin-telemetry/,
75+
/@salesforce\/plugin-command-reference/,
76+
];
77+
pluginNames = this.config.plugins.map((p) => p.name).filter((p) => !ignore.some((i) => i.test(p)));
6478
} else {
6579
pluginNames = flags.plugins;
6680
}

0 commit comments

Comments
 (0)