<commit_before>///<reference path="../.d.ts"/>
"use strict";

export class ProjectCommandParameter implements ICommandParameter {
	constructor(private $errors: IErrors,
		private $projectNameValidator: IProjectNameValidator) { }

	mandatory = true;
	validate(value: string): IFuture<boolean> {
		return (() => {
			if(!value) {
				this.$errors.fail("You must specify <App name> when creating a new project.");
			}

			return this.$projectNameValidator.validate(value);
		}).future<boolean>()();
	}
}

export class CreateProjectCommand implements ICommand {
	constructor(private $projectService: IProjectService,
		private $errors: IErrors,
		private $projectNameValidator: IProjectNameValidator) { }

	public enableHooks = false;

	execute(args: string[]): IFuture<void> {
		return (() => {
			this.$projectService.createProject(args[0]).wait();
		}).future<void>()();
	}

	allowedParameters = [new ProjectCommandParameter(this.$errors, this.$projectNameValidator) ]
}
$injector.registerCommand("create", CreateProjectCommand);<commit_msg>Warn users when creating applications named 'app'.<commit_after>///<reference path="../.d.ts"/>
"use strict";

export class ProjectCommandParameter implements ICommandParameter {
	constructor(private $errors: IErrors,
		private $logger: ILogger,
		private $projectNameValidator: IProjectNameValidator) { }

	mandatory = true;
	validate(value: string): IFuture<boolean> {
		return (() => {
			if(!value) {
				this.$errors.fail("You must specify <App name> when creating a new project.");
			}

			if (value.toUpperCase() === "APP") {
				this.$logger.warn("You cannot build aplications named 'app' in Xcode. Consider creating a project with different name.");
			}

			return this.$projectNameValidator.validate(value);
		}).future<boolean>()();
	}
}

export class CreateProjectCommand implements ICommand {
	constructor(private $projectService: IProjectService,
		private $errors: IErrors,
		private $logger: ILogger,
		private $projectNameValidator: IProjectNameValidator) { }

	public enableHooks = false;

	execute(args: string[]): IFuture<void> {
		return (() => {
			this.$projectService.createProject(args[0]).wait();
		}).future<void>()();
	}

	allowedParameters = [new ProjectCommandParameter(this.$errors, this.$logger, this.$projectNameValidator) ]
}
$injector.registerCommand("create", CreateProjectCommand);
{'fraction_non_alphanumeric': 0.1423125794155019, 'fraction_numerical': 0.0008470986869970351, 'mean_word_length': 5.435967302452316, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4714422', 'n_tokens_mistral': 714, 'n_tokens_neox': 660, 'n_words': 159}