Skip to content

Commit 43f5a10

Browse files
committed
Make the code a little terser
Signed-off-by: Chad Wilson <chadw@thoughtworks.com>
1 parent d45d264 commit 43f5a10

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/cli.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
22

3-
import {CommonSpawnOptions, spawn, spawnSync} from 'child_process';
4-
import {platform} from 'os';
5-
import {window} from 'vscode';
6-
import {GaugeCommands, GRADLE_COMMAND, MAVEN_COMMAND} from './constants';
7-
import {OutputChannel} from './execution/outputChannel';
3+
import { CommonSpawnOptions, spawn, spawnSync } from 'child_process';
4+
import { platform } from 'os';
5+
import { window } from 'vscode';
6+
import { GaugeCommands, GRADLE_COMMAND, MAVEN_COMMAND } from './constants';
7+
import { OutputChannel } from './execution/outputChannel';
88

99
export class CLI {
1010
private readonly _gaugeVersion: string;
@@ -25,11 +25,7 @@ export class CLI {
2525

2626
public static getDefaultSpawnOptions(): CommonSpawnOptions {
2727
// should only deal with platform specific options
28-
let options: CommonSpawnOptions = {};
29-
if (platform() === "win32") {
30-
options.shell = true;
31-
}
32-
return options;
28+
return platform() === "win32" ? { shell: true } : {};
3329
}
3430

3531
public static instance(): CLI {
@@ -112,11 +108,8 @@ export class CLI {
112108
}
113109

114110
public static getCommandCandidates(command: string): string[] {
115-
let validExecExt = [""];
116-
if (platform() === 'win32') {
117-
validExecExt.push(".exe", ".bat", ".cmd");
118-
}
119-
return validExecExt.map((ext) => `${command}${ext}`);
111+
return (platform() === 'win32' ? [".exe", ".bat", ".cmd"] : [""])
112+
.map((ext) => `${command}${ext}`);
120113
}
121114

122115
public static checkSpawnable(command: string): boolean {
@@ -132,7 +125,6 @@ export class CLI {
132125
}
133126

134127
private static getGradleCommand() {
135-
if (platform() === 'win32') return `${GRADLE_COMMAND}.bat`;
136-
return `./${GRADLE_COMMAND}`;
128+
return platform() === 'win32' ? `${GRADLE_COMMAND}.bat` : `./${GRADLE_COMMAND}`;
137129
}
138130
}

0 commit comments

Comments
 (0)