// Load a project so you can work on it.

import { apps } from "@/webapp"
import { sessionGet } from "@/session"

export default function (project: string) {
    const state = sessionGet()
    if (!project) throw `usage: load <project name>`

    if (state && apps().includes(project)) {
        state.project = project
        state.cwd = ""
    } else {
        return { error: `failed to load ${project}` }
    }
}