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

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

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

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