Skip to content

Commit

Permalink
run a lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsauravsahu committed Oct 16, 2022
1 parent 2ff7582 commit 8e10204
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/services/command-generator.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as os from 'os'
import * as path from 'path'
import * as vscode from 'vscode'
import type { OSType } from '../types'
import type {OSType} from '../types'

export type GeneratedCommand = {
command: string;
Expand All @@ -23,11 +23,11 @@ export class CommandGeneratorService {

public generateCommand(program: string,
args: string | undefined,
extraArgs: { [key in OSType]: string | undefined } | undefined = undefined,
extraArgs: {[key in OSType]: string | undefined} | undefined = undefined,
): GeneratedCommand {
const shell: string = this.shellRecords[this.osType]

let customizedProgramForOS = this.customizeProgram(program)
const customizedProgramForOS = this.customizeProgram(program)

return {
command: `${customizedProgramForOS} ${extraArgs ? extraArgs[this.osType] ?? '' : ''} ${args ?? ''}`,
Expand All @@ -38,25 +38,22 @@ export class CommandGeneratorService {
public customizeProgram(programName: string): string {
let programWithExecChanges = ''

if (programName !== 'code') { programWithExecChanges = programName }
else {
if (programName !== 'code') {
programWithExecChanges = programName
} else {
let execPrefixPath = ''

switch (this.osType) {
case 'Linux':
case 'Darwin':
execPrefixPath = path.join(vscode.env.appRoot, 'bin')
break
case 'Windows_NT':
default:
execPrefixPath = path.resolve(vscode.env.appRoot, '..', '..', 'bin')
break
}

if (vscode.env.appName === 'Visual Studio Code - Insiders') {
programWithExecChanges = path.join(execPrefixPath, 'code-insiders')
}
else {
programWithExecChanges = path.join(execPrefixPath, 'code')
}
programWithExecChanges = vscode.env.appName === 'Visual Studio Code - Insiders' ? path.join(execPrefixPath, 'code-insiders') : path.join(execPrefixPath, 'code')
}

if (this.osType === 'Windows_NT') {
Expand Down

0 comments on commit 8e10204

Please sign in to comment.