2021-08-07 21:45:59 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2021-08-07 23:57:00 +00:00
|
|
|
"github.com/maaslalani/confetty/confetti"
|
2021-08-07 21:45:59 +00:00
|
|
|
"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 {
|
2021-08-07 23:57:00 +00:00
|
|
|
p := tea.NewProgram(confetti.InitialModel(), tea.WithAltScreen())
|
2021-08-07 21:45:59 +00:00
|
|
|
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 {
|
2021-08-07 23:57:00 +00:00
|
|
|
p := tea.NewProgram(confetti.InitialModel(), tea.WithAltScreen())
|
2021-08-07 21:45:59 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|