Skip to content

Commit b10de63

Browse files
committed
chore: fix PR comments
1 parent 5fc7567 commit b10de63

File tree

12 files changed

+23
-23
lines changed

12 files changed

+23
-23
lines changed

lib/commands/add-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AddPlatformCommand extends ValidatePlatformCommandBase implements I
2727
this.$platformValidationService.validatePlatform(arg, this.$projectData);
2828

2929
if (!this.$platformValidationService.isPlatformSupportedForOS(arg, this.$projectData)) {
30-
this.$errors.fail(`Applications for platform ${arg} can not be built on this OS`);
30+
this.$errors.fail(`Applications for platform ${arg} cannot be built on this OS`);
3131
}
3232

3333
canExecute = await super.canExecuteCommandBase(arg);

lib/commands/appstore-upload.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class PublishIOS implements ICommand {
7979

8080
public async canExecute(args: string[]): Promise<boolean> {
8181
if (!this.$hostInfo.isDarwin) {
82-
this.$errors.fail("iOS publishing is only available on Mac OS X.");
82+
this.$errors.fail("iOS publishing is only available on macOS.");
8383
}
8484

8585
if (!this.$platformValidationService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {

lib/commands/build.ts

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
3535
}
3636

3737
protected async validateArgs(args: string[], platform: string): Promise<boolean> {
38-
return await this.validateArgsCore(args, platform);
39-
}
40-
41-
private async validateArgsCore(args: string[], platform: string): Promise<boolean> {
4238
if (args.length !== 0) {
4339
this.$errors.failWithHelp(`The arguments '${args.join(" ")}' are not valid for the current command.`);
4440
}

lib/common/commands/device/list-devices.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ListDevicesCommand implements ICommand {
1515
if (this.$options.availableDevices) {
1616
const platform = this.$mobileHelper.normalizePlatformName(args[0]);
1717
if (!platform && args[0]) {
18-
this.$errors.failWithHelp(`${args[0]} is not a valid device platform. The valid platforms are ${formatListOfNames(this.$mobileHelper.platformNames)}`);
18+
this.$errors.fail(`${args[0]} is not a valid device platform. The valid platforms are ${formatListOfNames(this.$mobileHelper.platformNames)}`);
1919
}
2020

2121
const availableEmulatorsOutput = await this.$devicesService.getEmulatorImages({ platform });

lib/common/commands/package-manager-set.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class PackageManagerCommand implements ICommand {
1313
} else if (args[0] === 'npm') {
1414
return this.$userSettingsService.saveSetting("packageManager", "npm");
1515
}
16-
return this.$errors.failWithHelp(`${args[0]} is not a valid package manager. Only yarn or npm are supported.`);
16+
return this.$errors.fail(`${args[0]} is not a valid package manager. Only yarn or npm are supported.`);
1717
}
1818
}
1919

lib/common/commands/proxy/proxy-set.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class ProxySetCommand extends ProxyCommandBase {
4444

4545
let urlObj = parse(urlString);
4646
if ((!urlObj.protocol || !urlObj.hostname) && !isInteractive()) {
47-
this.$errors.failWithHelp("The url you have entered is invalid please enter a valid url containing a valid protocol and hostname.");
47+
this.$errors.fail("The url you have entered is invalid please enter a valid url containing a valid protocol and hostname.");
4848
}
4949

5050
while (!urlObj.protocol || !urlObj.hostname) {
@@ -58,14 +58,14 @@ export class ProxySetCommand extends ProxyCommandBase {
5858
const authCredentials = getCredentialsFromAuth(urlObj.auth || "");
5959
if ((username && authCredentials.username && username !== authCredentials.username) ||
6060
password && authCredentials.password && password !== authCredentials.password) {
61-
this.$errors.failWithHelp("The credentials you have provided in the url address mismatch those passed as command line arguments.");
61+
this.$errors.fail("The credentials you have provided in the url address mismatch those passed as command line arguments.");
6262
}
6363
username = username || authCredentials.username;
6464
password = password || authCredentials.password;
6565

6666
if (!isInteractive()) {
6767
if (noPort) {
68-
this.$errors.failWithHelp(`The port you have specified (${port || "none"}) is not valid.`);
68+
this.$errors.fail(`The port you have specified (${port || "none"}) is not valid.`);
6969
} else if (this.isPasswordRequired(username, password)) {
7070
this.$errors.failWithHelp("Console is not interactive - you need to supply all command parameters.");
7171
}

lib/common/errors.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,18 @@ export class Errors implements IErrors {
126126

127127
public fail(optsOrFormatStr: string | IFailOptions, ...args: any[]): never {
128128
const opts = this.getFailOptions(optsOrFormatStr);
129-
return this.failWithOptions(opts, false, args);
129+
return this.failWithOptions(opts, false, ...args);
130130
}
131131

132132
@deprecated("Use `fail` instead.")
133133
public failWithoutHelp(optsOrFormatStr: string | IFailOptions, ...args: any[]): never {
134-
return this.fail(optsOrFormatStr, args);
134+
return this.fail(optsOrFormatStr, ...args);
135135
}
136136

137137
public failWithHelp(optsOrFormatStr: string | IFailOptions, ...args: any[]): never {
138138
const opts = this.getFailOptions(optsOrFormatStr);
139139

140-
return this.failWithOptions(opts, true, args);
140+
return this.failWithOptions(opts, true, ...args);
141141
}
142142

143143
private getFailOptions(optsOrFormatStr: string | IFailOptions): IFailOptions {

lib/common/mobile/mobile-core/devices-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
5252
@performanceLog()
5353
public async pickSingleDevice(options: Mobile.IPickSingleDeviceOptions): Promise<Mobile.IDevice> {
5454
if (options.onlyDevices && options.onlyEmulators) {
55-
this.$errors.failWithHelp(DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR);
55+
this.$errors.fail(DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR);
5656
}
5757

5858
if (options.deviceId) {
@@ -679,7 +679,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
679679
} else if (platforms.length === 0) {
680680
this.$errors.fail(constants.ERROR_NO_DEVICES);
681681
} else {
682-
this.$errors.failWithHelp("Multiple device platforms detected (%s). Specify platform or device on command line.",
682+
this.$errors.fail("Multiple device platforms detected (%s). Specify platform or device on command line.",
683683
helpers.formatListOfNames(platforms, "and"));
684684
}
685685
}

lib/common/services/commands-service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ export class CommandsService implements ICommandsService {
124124
// If canExecuteCommand returns false, the command cannot be executed or there's no such command at all.
125125
const command = this.$injector.resolveCommand(commandName);
126126
if (command) {
127-
this.$logger.error(`Command '${commandName} ${commandArguments}' cannot be executed.`);
127+
let commandWithArgs = commandName;
128+
if (commandArguments && commandArguments.length) {
129+
commandWithArgs += ` ${commandArguments.join(" ")}`;
130+
}
131+
this.$logger.error(`Command '${commandWithArgs}' cannot be executed.`);
128132
await this.printHelpSuggestion(commandName);
129133
}
130134
}
@@ -153,7 +157,7 @@ export class CommandsService implements ICommandsService {
153157
return true;
154158
}
155159

156-
this.$errors.failWithHelp("Unable to execute command '%s'. Use '$ %s %s --help' for help.", beautifiedName, this.$staticConfig.CLIENT_NAME.toLowerCase(), beautifiedName);
160+
this.$errors.fail(`Unable to execute command '${beautifiedName}'.`);
157161
return false;
158162
}
159163

lib/common/validators/project-name-validator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class ProjectNameValidator implements IProjectNameValidator {
5454
const isSuccessful = validationResult.isSuccessful;
5555

5656
if (!isSuccessful) {
57-
this.$errors.failWithHelp(validationResult.error);
57+
this.$errors.fail(validationResult.error);
5858
}
5959

6060
return isSuccessful;

lib/services/ios-project-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
104104

105105
public async validateOptions(projectId: string, provision: true | string, teamId: true | string): Promise<boolean> {
106106
if (provision && teamId) {
107-
this.$errors.failWithHelp("The options --provision and --teamId are mutually exclusive.");
107+
this.$errors.fail("The options --provision and --teamId are mutually exclusive.");
108108
}
109109

110110
if (provision === true) {
111111
await this.$iOSProvisionService.listProvisions(projectId);
112-
this.$errors.failWithHelp("Please provide provisioning profile uuid or name with the --provision option.");
112+
this.$errors.fail("Please provide provisioning profile uuid or name with the --provision option.");
113113
}
114114

115115
if (teamId === true) {
116116
await this.$iOSProvisionService.listTeams();
117-
this.$errors.failWithHelp("Please provide team id or team name with the --teamId options.");
117+
this.$errors.fail("Please provide team id or team name with the --teamId options.");
118118
}
119119

120120
return true;

lib/services/platform/platform-validation-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class PlatformValidationService implements IPlatformValidationService {
3131

3232
if (!this.isValidPlatform(platform, projectData)) {
3333
const platformNames = helpers.formatListOfNames(this.$mobileHelper.platformNames);
34-
this.$errors.failWithHelp(`Invalid platform ${platform}. Valid platforms are ${platformNames}.`);
34+
this.$errors.fail(`Invalid platform ${platform}. Valid platforms are ${platformNames}.`);
3535
}
3636
}
3737

0 commit comments

Comments
 (0)