56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"mcquay.me/yay"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
const usage = "usage: yay <shrug|dance>"
|
|
|
|
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()
|
|
},
|
|
}
|
|
|
|
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(version)
|
|
main.Execute()
|
|
}
|