-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathlivesync.ts
32 lines (26 loc) · 876 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
32
///<reference path="../.d.ts"/>
"use strict";
export class LivesyncCommand implements ICommand {
constructor(private $logger: ILogger,
private $usbLiveSyncService: IUsbLiveSyncService,
private $mobileHelper: Mobile.IMobileHelper,
private $options: IOptions,
private $errors: IErrors) { }
public execute(args: string[]): IFuture<void> {
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 _.contains(this.$mobileHelper.platformNames, this.$mobileHelper.normalizePlatformName(platform));
}
return true;
}).future<boolean>()();
}
allowedParameters: ICommandParameter[] = [];
}
$injector.registerCommand("livesync", LivesyncCommand);