-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathlivesync.ts
31 lines (26 loc) · 928 Bytes
/
livesync.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 LivesyncCommand implements ICommand {
constructor(private $logger: ILogger,
private $usbLiveSyncService: ILiveSyncService,
private $mobileHelper: Mobile.IMobileHelper,
private $options: IOptions,
private $platformService: IPlatformService,
private $errors: IErrors) { }
public execute(args: string[]): IFuture<void> {
this.$platformService.deployPlatform(args[0]).wait();
return this.$usbLiveSyncService.liveSync(args[0]);
}
public canExecute(args: string[]): IFuture<boolean> {
return (() => {
if(args.length >= 2) {
this.$errors.fail("Invalid number of arguments.");
}
let platform = args[0];
if(platform) {
return _.includes(this.$mobileHelper.platformNames, this.$mobileHelper.normalizePlatformName(platform));
}
return true;
}).future<boolean>()();
}
allowedParameters: ICommandParameter[] = [];
}
$injector.registerCommand("livesync", LivesyncCommand);