Created
January 27, 2023 23:32
-
-
Save mstine/d7222e032960531c85a6e2f878e50830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: PARA | |
import "@johnlindquist/kit" | |
let { roots, write } = await db("db/para-roots.json", { roots: [] }) | |
onTab("PARA-Roots", async () => { | |
while (true) { | |
let activeRoot = await arg("Set active PARA Root:", roots) | |
let pRoots = _.partition(roots, activeRoot) | |
pRoots[0][0].tag = "active" | |
pRoots[1].map((inactiveRoot) => { | |
inactiveRoot.tag = "" | |
}) | |
await write() | |
} | |
}) | |
onTab("New", async () => { | |
let [name, path] = await fields([ | |
{ | |
name: "name", | |
label: "Name", | |
type: "text", | |
placeholder: "New PARA-Root:" | |
}, | |
{ | |
name: "path", | |
label: "Path", | |
type: "file", | |
placeholder: "Select a Path:" | |
} | |
]) | |
roots.push({ name, path, id: uuid(), tag: "" }) | |
await write() | |
setTab("PARA-Roots") | |
}) | |
onTab("Remove", async () => { | |
let root = await arg("Remove PARA-Root:", roots) | |
_.remove(roots, r => r.id === root.id) | |
await write() | |
setTab("PARA-Roots") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment