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

export function openTerminal(fullPath: string) {
  const currentPlatform = platform()
  let command = ''

  switch (currentPlatform) {
    case 'darwin': {
      command = 'open -a Terminal'
      break
    }
    case 'win32': {
      command = 'start /D "%cd%" cmd'
      break
    }
  }

  return spawn('open', [ '-a', 'Terminal', fullPath ])
}
import { spawn } from 'child_process'
import { platform } from 'os'

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

export function openTerminal(fullPath: string) {
  const currentPlatform = platform()
  const command = new Command()

  switch (currentPlatform) {
    case 'darwin': {
      command.name = 'open'
      command.args = [ '-a', 'Terminal', fullPath ]
      break
    }
    case 'win32': {
      command.name = 'start'
      command.args = [ '/D', '"%cd%"', 'cmd', fullPath ]
      break
    }
  }

  return spawn(command.name, command.args)
}
Clean up open terminal function
Clean up open terminal function
