fix: don't ignore sub dirs
This commit is contained in:
parent
767ba3ad0b
commit
e1057b51b9
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
cairde
|
||||
/cairde
|
||||
*.log
|
||||
*.work
|
||||
|
68
cmd/cairde/main.go
Normal file
68
cmd/cairde/main.go
Normal file
@ -0,0 +1,68 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cairde/internal/models"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
|
||||
openPrivacyLog "git.openprivacy.ca/openprivacy/log"
|
||||
_ "github.com/mutecomm/go-sqlcipher/v4"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
const help = `cairde [options]
|
||||
|
||||
A text-based user interface for metadata resistant online chat.
|
||||
|
||||
Options:
|
||||
-h output help
|
||||
`
|
||||
|
||||
var helpFlag bool
|
||||
|
||||
func main() {
|
||||
flag.BoolVar(&helpFlag, "h", false, "output help")
|
||||
flag.Parse()
|
||||
|
||||
if helpFlag {
|
||||
fmt.Print(help)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// NOTE(d1): pending https://git.coopcloud.tech/decentral1se/cairde/issues/1
|
||||
_, err := exec.LookPath("tor")
|
||||
if err != nil {
|
||||
log.Fatal("could not find 'tor' command, is it installed?")
|
||||
}
|
||||
|
||||
f, err := tea.LogToFile("cairde.log", "debug")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
filelogger, err := openPrivacyLog.NewFile(openPrivacyLog.LevelInfo, "cwtch.log")
|
||||
if err == nil {
|
||||
openPrivacyLog.SetStd(filelogger)
|
||||
}
|
||||
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
log.Fatalf("unable to determine current user: %s", err)
|
||||
}
|
||||
|
||||
p := tea.NewProgram(
|
||||
models.NewMainModel(user.Username, user.HomeDir),
|
||||
tea.WithAltScreen(),
|
||||
tea.WithMouseCellMotion(),
|
||||
)
|
||||
|
||||
if err := p.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user