Skip to content

Commit 7809c99

Browse files
committed
fix(help): filter out unnecessary global options
1 parent fb38c7a commit 7809c99

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/@ionic/cli-framework/src/lib/help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ export class NamespaceStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N e
134134
return wordWrap(metadata.description.trim(), { indentation: 4 });
135135
}
136136

137-
async getExtraOptions(): Promise<string[]> {
137+
async getGlobalOptions(): Promise<string[]> {
138138
return [];
139139
}
140140

141141
async formatUsage(): Promise<string> {
142142
const { strong, weak, input } = this.colors;
143143
const fullName = await this.getNamespaceFullName();
144144

145-
const options = ['--help', ...(await this.getExtraOptions())];
145+
const options = ['--help', ...(await this.getGlobalOptions())];
146146
const usageLines = [
147147
`<command> ${weak('[<args>]')} ${options.map(opt => weak('[' + opt + ']')).join(' ')} ${weak('[options]')}`,
148148
];

packages/ionic/src/lib/help.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CommandGroup, CommandHelpSchema as BaseCommandHelpSchema, CommandSchemaHelpFormatter as BaseCommandSchemaHelpFormatter, CommandStringHelpFormatter as BaseCommandStringHelpFormatter, NamespaceGroup, NamespaceHelpFormatterDeps as BaseNamespaceHelpFormatterDeps, NamespaceSchemaHelpFormatter as BaseNamespaceSchemaHelpFormatter, NamespaceStringHelpFormatter as BaseNamespaceStringHelpFormatter, OptionGroup, formatOptionName, isOptionVisible } from '@ionic/cli-framework';
2+
import { filter } from '@ionic/cli-framework/utils/array';
23
import chalk from 'chalk';
34

45
import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, HydratedCommandMetadata, ICommand, INamespace, NamespaceMetadata } from '../definitions';
@@ -68,10 +69,9 @@ export class NamespaceStringHelpFormatter extends BaseNamespaceStringHelpFormatt
6869
return formatGroupDecorations(COMMAND_DECORATIONS, cmd.groups);
6970
}
7071

71-
async getExtraOptions(): Promise<string[]> {
72-
return GLOBAL_OPTIONS
73-
.filter(opt => isOptionVisible(opt))
74-
.map(opt => formatOptionName(opt, { showAliases: false }));
72+
async getGlobalOptions(): Promise<string[]> {
73+
const visibleOptions = await filter(GLOBAL_OPTIONS, async opt => isOptionVisible(opt));
74+
return visibleOptions.map(opt => formatOptionName(opt, { showAliases: false }));
7575
}
7676

7777
async formatCommands() {

0 commit comments

Comments
 (0)