Skip to content

Commit b54d772

Browse files
authored
List possible categories (microsoft#78198)
* List possible categories * TODO comment * Message if category is invalid
1 parent f2b65a9 commit b54d772

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/vs/code/node/cliProcessMain.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,26 @@ export class Main {
112112

113113
private async listExtensions(showVersions: boolean, category?: string): Promise<void> {
114114
let extensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
115-
if (category) {
115+
// TODO: we should save this array in a common place so that the command and extensionQuery can use it that way changing it is easier
116+
const categories = ['"programming languages"', 'snippets', 'linters', 'themes', 'debuggers', 'formatters', 'keymaps', '"scm providers"', 'other', '"extension packs"', '"language packs"'];
117+
if (category && category !== '') {
118+
if (categories.indexOf(category.toLowerCase()) < 0) {
119+
console.log('Invalid category please enter a valid category. To list valid categories run --category without a category specified');
120+
return;
121+
}
116122
extensions = extensions.filter(e => {
117123
if (e.manifest.categories) {
118124
const lowerCaseCategories: string[] = e.manifest.categories.map(c => c.toLowerCase());
119125
return lowerCaseCategories.indexOf(category.toLowerCase()) > -1;
120126
}
121127
return false;
122128
});
129+
} else if (category === '') {
130+
console.log('Possible Categories: ');
131+
categories.forEach(category => {
132+
console.log(category);
133+
});
134+
return;
123135
}
124136
extensions.forEach(e => console.log(getId(e.manifest, showVersions)));
125137
}
@@ -369,4 +381,4 @@ export async function main(argv: ParsedArgs): Promise<void> {
369381
disposables.dispose();
370382
}
371383
});
372-
}
384+
}

0 commit comments

Comments
 (0)