diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts
index e7084481c1..86da8b20f8 100644
--- a/lib/bootstrap.ts
+++ b/lib/bootstrap.ts
@@ -15,6 +15,7 @@ $injector.require("platformService", "./services/platform-service");
$injector.requireCommand("create", "./commands/create-project");
$injector.requireCommand("platform|*list", "./commands/list-platforms");
$injector.requireCommand("platform|add", "./commands/add-platform");
+$injector.requireCommand("platform|remove", "./commands/remove-platform");
$injector.requireCommand("run", "./commands/run");
$injector.requireCommand("prepare", "./commands/prepare");
$injector.requireCommand("build", "./commands/build");
diff --git a/lib/commands/remove-platform.ts b/lib/commands/remove-platform.ts
new file mode 100644
index 0000000000..c45586470d
--- /dev/null
+++ b/lib/commands/remove-platform.ts
@@ -0,0 +1,12 @@
+///
+
+export class RemovePlatformCommand implements ICommand {
+ constructor(private $platformService: IPlatformService) { }
+
+ execute(args: string[]): IFuture {
+ return (() => {
+ this.$platformService.removePlatforms(args).wait();
+ }).future()();
+ }
+}
+$injector.registerCommand("platform|remove", RemovePlatformCommand);
\ No newline at end of file
diff --git a/lib/definitions/platform.d.ts b/lib/definitions/platform.d.ts
index a0fce8fbe9..2c3d1d9e97 100644
--- a/lib/definitions/platform.d.ts
+++ b/lib/definitions/platform.d.ts
@@ -5,6 +5,7 @@ interface IPlatformService {
runPlatform(platform: string): IFuture;
preparePlatform(platform: string): IFuture;
buildPlatform(platform: string): IFuture;
+ removePlatforms(platforms: string[]): IFuture;
}
interface IPlatformData {
diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts
index d6beb3ec75..97630514d5 100644
--- a/lib/services/platform-service.ts
+++ b/lib/services/platform-service.ts
@@ -162,6 +162,22 @@ export class PlatformService implements IPlatformService {
}).future()();
}
+ public removePlatforms(platforms: string[]): IFuture {
+ return (() => {
+ if(!platforms || platforms.length === 0) {
+ this.$errors.fail("No platform specified. Please specify a platform to remove");
+ }
+
+ _.each(platforms, platform => {
+ this.validatePlatformInstalled(platform);
+
+ var platformDir = path.join(this.$projectData.platformsDir, platform);
+ this.$fs.deleteDirectory(platformDir).wait();
+ });
+
+ }).future()();
+ }
+
private validatePlatform(platform: string): void {
if (!this.isValidPlatform(platform)) {
this.$errors.fail("Invalid platform %s. Valid platforms are %s.", platform, helpers.formatListOfNames(this.$platformsData.platformsNames));
diff --git a/resources/help.txt b/resources/help.txt
index 6db2492d37..eb29b148c4 100644
--- a/resources/help.txt
+++ b/resources/help.txt
@@ -9,6 +9,7 @@ General commands:
create Creates a new NativeScript project with given project name and application identifier.
platform add Creates a new platform specific project.
platform list Lists all available and all installed platforms.
+ platform remove Removes the platform specific project.
prepare Copies files for specified platform, so that the project is ready to build in platform specific SDK.
build Builds the project for the selected target platform and produces an application package.
run This is shorthand for prepare and build.
@@ -81,6 +82,20 @@ Platform-specific usage:
Creates a new platform specific project. In this version of Telerik NativeScript you can create only ios and android projects.
You can create Android projects on windows and Mac machine. You can create ios projects only on Mac machine.
+
+--[/]--
+
+--[platform|remove]--
+
+Usage:
+ $ tns platform remove
+
+Platform-specific usage:
+ $ tns platform remove android
+ $ tns platform remove ios
+
+Removes the platform specific project.
+
--[/]--
--[prepare]--