mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-26 13:19:42 +00:00
List possible categories (#78198)
* List possible categories * TODO comment * Message if category is invalid
This commit is contained in:
@@ -112,7 +112,13 @@ export class Main {
|
||||
|
||||
private async listExtensions(showVersions: boolean, category?: string): Promise<void> {
|
||||
let extensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
if (category) {
|
||||
// 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
|
||||
const categories = ['"programming languages"', 'snippets', 'linters', 'themes', 'debuggers', 'formatters', 'keymaps', '"scm providers"', 'other', '"extension packs"', '"language packs"'];
|
||||
if (category && category !== '') {
|
||||
if (categories.indexOf(category.toLowerCase()) < 0) {
|
||||
console.log('Invalid category please enter a valid category. To list valid categories run --category without a category specified');
|
||||
return;
|
||||
}
|
||||
extensions = extensions.filter(e => {
|
||||
if (e.manifest.categories) {
|
||||
const lowerCaseCategories: string[] = e.manifest.categories.map(c => c.toLowerCase());
|
||||
@@ -120,6 +126,12 @@ export class Main {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else if (category === '') {
|
||||
console.log('Possible Categories: ');
|
||||
categories.forEach(category => {
|
||||
console.log(category);
|
||||
});
|
||||
return;
|
||||
}
|
||||
extensions.forEach(e => console.log(getId(e.manifest, showVersions)));
|
||||
}
|
||||
@@ -369,4 +381,4 @@ export async function main(argv: ParsedArgs): Promise<void> {
|
||||
disposables.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user