mirror of
https://github.com/onyx-and-iris/lottery-cli.git
synced 2026-08-17 00:34:25 +00:00
add list subcommand
add renderKindList()
This commit is contained in:
24
cmd/lottery/list.go
Normal file
24
cmd/lottery/list.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/onyx-and-iris/lottery-cli"
|
||||
)
|
||||
|
||||
// listCmd represents the list command.
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List all available lottery kinds.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println(renderKindList(lottery.AllKinds()))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(listCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user