import arg from 'arg'
import { platform } from 'os'
import { logInfo, logError } from '../log'
import { PlatformClient } from 'platform-client'

export const startHandler = cliArgs => {
  logInfo({ message: 'Running start command' })

  const Platforms = {
    windows: 'win32',
    mac: 'darwin'
  }

  if ([Platforms.windows].includes(platform())) {
    return logError({ message: 'Deployment tools do not support this os' })
  }

  const parsedArgs = arg({
    '--platforms': String,
    '-p': '--platforms'
  }, { argv: cliArgs })

  PlatformClient.start(parsedArgs['--platforms'])
}
