package main import ( "fmt" "time" "mcquay.me/yay" "github.com/spf13/cobra" ) const usage = "usage: yay " func main() { frameRate := 200 main := &cobra.Command{ Use: "yay", Short: "cute cli animations", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewYay(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } main.PersistentFlags().IntVarP(&frameRate, "timeout", "t", 200, "timeout between animations") shrug := &cobra.Command{ Use: "shrug", Short: "you know, a shrug", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewShrug(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } dance := &cobra.Command{ Use: "dance", Short: "shake it, shake it!!", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewDance(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } claps := &cobra.Command{ Use: "claps", Short: "clap it, clap it!!", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewClaps(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } apple := &cobra.Command{ Use: "apple", Short: "Go Apple, Go!", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewApple(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } hf := &cobra.Command{ Use: "hf", Short: "high five!", Run: func(cmd *cobra.Command, args []string) { t := yay.NewViewPort(yay.NewHighFive(), time.Duration(frameRate)*time.Millisecond) t.Run() }, } version := &cobra.Command{ Use: "version", Short: "prints the version to stdout", Run: func(cmd *cobra.Command, args []string) { fmt.Println("2015-06-29") }, } main.AddCommand(shrug) main.AddCommand(dance) main.AddCommand(claps) main.AddCommand(apple) main.AddCommand(version) main.AddCommand(hf) main.Execute() }