Skip to content

Commit

Permalink
Clear screen at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessOne91 committed Jul 11, 2024
1 parent 7b44787 commit 64b3fc4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/bisturi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ package main
import (
"log"
"os"
"os/exec"

models "github.com/NamelessOne91/bisturi/tui/models"
tea "github.com/charmbracelet/bubbletea"
)

func clearScreen() error {
cmd := exec.Command("clear") // On Windows use exec.Command("cmd", "/c", "cls")
cmd.Stdout = os.Stdout
return cmd.Run()
}

func main() {
if len(os.Getenv("BISTURI_DEBUG")) > 0 {
f, err := tea.LogToFile("bisturi_debug.log", "debug")
Expand All @@ -17,6 +24,10 @@ func main() {
defer f.Close()
}

if err := clearScreen(); err != nil {
log.Fatal("Failed to clear the screen: ", err)
}

p := tea.NewProgram(models.NewBisturiModel(), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
log.Fatal("Error running program:", err)
Expand Down

0 comments on commit 64b3fc4

Please sign in to comment.