-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathplatform-clean.ts
33 lines (26 loc) · 1.1 KB
/
platform-clean.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
32
33
export class CleanCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];
constructor(private $options: IOptions,
private $projectData: IProjectData,
private $platformService: IPlatformService,
private $errors: IErrors,
private $platformsData: IPlatformsData) {
this.$projectData.initializeProjectData();
}
public async execute(args: string[]): Promise<void> {
await this.$platformService.cleanPlatforms(args, this.$options.platformTemplate, this.$projectData, this.$options);
}
public async canExecute(args: string[]): Promise<boolean> {
if (!args || args.length === 0) {
this.$errors.fail("No platform specified. Please specify a platform to clean");
}
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|clean", CleanCommand);