-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathremove-platform.ts
31 lines (25 loc) · 1.04 KB
/
remove-platform.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export class RemovePlatformCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];
constructor(private $platformService: IPlatformService,
private $projectData: IProjectData,
private $errors: IErrors,
private $platformsData: IPlatformsData) {
this.$projectData.initializeProjectData();
}
public execute(args: string[]): Promise<void> {
return this.$platformService.removePlatforms(args, this.$projectData);
}
public async canExecute(args: string[]): Promise<boolean> {
if (!args || args.length === 0) {
this.$errors.fail("No platform specified. Please specify a platform to remove");
}
for (let platform of args) {
this.$platformService.validatePlatformInstalled(platform, this.$projectData);
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
}
return true;
}
}
$injector.registerCommand("platform|remove", RemovePlatformCommand);