yay/cmd/yay/main.go

86 lines
1.9 KiB
Go
Raw Normal View History

package main
2015-06-29 23:24:02 -07:00
import (
"fmt"
2015-06-29 23:58:13 -07:00
"time"
2015-06-29 23:24:02 -07:00
"mcquay.me/yay"
2015-06-29 23:58:13 -07:00
"github.com/spf13/cobra"
2015-06-29 23:24:02 -07:00
)
2015-06-29 23:24:02 -07:00
const usage = "usage: yay <shrug|dance>"
func main() {
2015-06-29 23:58:13 -07:00
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()
},
2015-06-29 23:24:02 -07:00
}
2015-06-29 23:58:13 -07:00
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()
},
}
2016-06-02 16:33:36 -07:00
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()
},
}
2018-09-09 19:09:56 -07:00
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()
},
}
2019-04-14 09:51:43 -07:00
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()
},
}
2015-06-29 23:58:13 -07:00
version := &cobra.Command{
Use: "version",
Short: "prints the version to stdout",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("2015-06-29")
},
2015-06-29 23:24:02 -07:00
}
2015-06-29 23:58:13 -07:00
main.AddCommand(shrug)
main.AddCommand(dance)
2016-06-02 16:33:36 -07:00
main.AddCommand(claps)
2018-09-09 19:09:56 -07:00
main.AddCommand(apple)
2015-06-29 23:58:13 -07:00
main.AddCommand(version)
2019-04-14 09:51:43 -07:00
main.AddCommand(hf)
2015-06-29 23:58:13 -07:00
main.Execute()
}