🏃 🤫 📚
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
934 B

package main
import (
"flag"
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
)
const help = `go-sh-manymanuals: TODO
TODO
Options:
-h output help
`
var helpFlag bool
type Configuration struct {
ManualDir string
}
func handleCliFlags() {
flag.BoolVar(&helpFlag, "h", false, "output help")
flag.Parse()
}
type model struct {
}
func initialModel() model {
return model{}
}
func (m model) Init() tea.Cmd {
return nil
}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
return m, tea.Quit
}
}
return m, nil
}
func (m model) View() string {
return ""
}
func main() {
handleCliFlags()
if helpFlag {
fmt.Printf(help)
os.Exit(0)
}
p := tea.NewProgram(initialModel(), tea.WithAltScreen())
if err := p.Start(); err != nil {
fmt.Printf("oops, something went wrong: %v", err)
os.Exit(1)
}
}