import { spawn } from 'child_process'
import { platform } from 'os'

class Command {
  public name: string
  public args: string[]
}

/** Opens a shell setting the working directory to fullpath. If a shell is not specified, OS defaults are used. */
export function openShell(fullPath: string, shell?: string) {
  const currentPlatform = platform()
  const command = new Command

  switch (currentPlatform) {
    case 'darwin': {
      command.name = 'open'
      command.args = [ '-a', shell || 'Terminal', fullPath ]
      break
    }
    case 'win32': {
      command.name = 'START'
      command.args = [ shell || 'cmd', '/D', `"${fullPath}"` , 'title', 'GitHub Desktop' ]
      break
    }
  }

  spawn(command.name, command.args, { 'shell' : true })
}

import { spawn } from 'child_process'

/** Opens a shell setting the working directory to fullpath. If a shell is not specified, OS defaults are used. */
export function openShell(fullPath: string, shell?: string) {
  let commandName: string = ''
  let commandArgs: string[] = []

  if ( __DARWIN__) {
    commandName = 'open'
    commandArgs = [ '-a', shell || 'Terminal', fullPath ]
  }
  else if (__WIN32__) {
    commandName = 'START'
    commandArgs = [ shell || 'cmd', '/D', `"${fullPath}"` , 'title', 'GitHub Desktop' ]
  }

  spawn(commandName, commandArgs, { 'shell' : true })
}

Use global defaults and remove Command class in favor of local variables
Use global defaults and remove Command class in favor of local variables
