chore: first commit.

This commit is contained in:
CronyAkatsuki 2025-10-19 18:14:17 +02:00
commit 7edd412b2b
10 changed files with 936 additions and 0 deletions

51
main.go Normal file
View file

@ -0,0 +1,51 @@
package main
import (
"flag"
"fmt"
"os"
"os/exec"
)
func main() {
sb := os.Getenv("SECOND_BRAIN")
ParseFlags(sb)
}
func ParseFlags(sb string) {
note := sb + "/notes"
// daily := sb + "/periodic/daily"
// templates := sb + "/templates"
quickPtr := flag.Bool("q", false, "Open quick file for notes")
flag.Parse()
fileName := flag.Args()
if *quickPtr {
file := note + "/quick.md"
OpenNvim(file)
os.Exit(0)
}
if len(fileName) == 0 {
fmt.Println("You didn't specify a note name")
os.Exit(1)
}
file := note + "/" + fileName[0] + ".md"
OpenNvim(file)
}
func OpenNvim(file string) {
nvim := exec.Command("nvim", file)
nvim.Stdin = os.Stdin
nvim.Stdout = os.Stdout
nvim.Stderr = os.Stderr
err := nvim.Run()
if err != nil {
panic(err)
}
}