confetty/cmd/root.go
Maas Lalani 7a252dff8d
fireworks 🎆
2021-08-07 17:46:04 -04:00

54 lines
1.2 KiB
Go

package cmd
import (
"fmt"
"os"
"github.com/maaslalani/confetty/confetty"
"github.com/maaslalani/confetty/fireworks"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "confetty",
Short: "Confetti in your TTY",
Long: `Confetty gives your confetti and fireworks in your terminal`,
RunE: func(cmd *cobra.Command, args []string) error {
p := tea.NewProgram(confetty.InitialModel(), tea.WithAltScreen())
return p.Start()
},
}
var confettiCmd = &cobra.Command{
Use: "confetti",
Aliases: []string{"confetty"},
Short: "Confetti in your TTY",
RunE: func(cmd *cobra.Command, args []string) error {
p := tea.NewProgram(confetty.InitialModel(), tea.WithAltScreen())
return p.Start()
},
}
var fireworksCmd = &cobra.Command{
Use: "fireworks",
Short: "Fireworks in your TTY",
RunE: func(cmd *cobra.Command, args []string) error {
p := tea.NewProgram(fireworks.InitialModel(), tea.WithAltScreen())
return p.Start()
},
}
func init() {
rootCmd.AddCommand(confettiCmd)
rootCmd.AddCommand(fireworksCmd)
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}