Skip to content

Instantly share code, notes, and snippets.

@mstine
Created January 27, 2023 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstine/d7222e032960531c85a6e2f878e50830 to your computer and use it in GitHub Desktop.
Save mstine/d7222e032960531c85a6e2f878e50830 to your computer and use it in GitHub Desktop.
// 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