import "@johnlindquist/kit"
let fkill = await npm('fkill')
let open = await npm ('open')
let pslist = await npm ('ps-list')
let processes = await pslist()
let procArray = []
for (let i of processes){
procArray.push(i.name)
}
let appChoice = await arg("Choose a process", procArray)
console.log(`Closing ${appChoice}`)
fkill(appChoice, {
force: true
})
await wait(1000)
console.log(`Opening ${appChoice}`)
open(appChoice.replace(".exe", ""))