gum/main.go

41 lines
807 B
Go
Raw Normal View History

2022-06-11 00:07:40 +02:00
package main
import (
"github.com/alecthomas/kong"
2022-07-07 19:26:35 +02:00
"github.com/charmbracelet/gum/internal/stdin"
"github.com/charmbracelet/lipgloss"
"github.com/muesli/termenv"
2022-06-11 00:07:40 +02:00
)
func main() {
lipgloss.SetColorProfile(termenv.ANSI256)
2022-07-07 19:26:35 +02:00
gum := &Gum{}
ctx := kong.Parse(gum,
kong.Name("gum"),
kong.Description("Tasty Bubble Gum for your shell."),
2022-06-11 00:07:40 +02:00
kong.UsageOnError(),
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
Summary: false,
}))
switch ctx.Command() {
case "input":
2022-07-07 19:26:35 +02:00
gum.Input.Run()
case "write":
2022-07-07 19:26:35 +02:00
gum.Write.Run()
2022-06-11 00:07:40 +02:00
case "search":
2022-07-07 19:26:35 +02:00
gum.Search.Run()
2022-06-11 00:07:40 +02:00
case "spin <command>":
2022-07-07 19:26:35 +02:00
gum.Spin.Run()
case "progress":
gum.Progress.Run()
2022-06-11 00:07:40 +02:00
case "style":
input, _ := stdin.Read()
2022-07-07 19:26:35 +02:00
gum.Style.Text = []string{input}
gum.Style.Run()
2022-06-11 00:07:40 +02:00
case "style <text>":
2022-07-07 19:26:35 +02:00
gum.Style.Run()
2022-06-11 00:07:40 +02:00
case "layout":
}
}