* add 'map' cli command - provides the following map information functions: - list all available maps in the global registry - display map metadata - update docs with map command examples * add list and info subcommands to map cli command * rename map command list and info factory functions * add --all flag to map info subcommand * handle cmd.Help error
22 lines
407 B
Go
22 lines
407 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/BattlesnakeOfficial/rules/maps"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func NewMapListCommand() *cobra.Command {
|
|
var listCmd = &cobra.Command{
|
|
Use: "list",
|
|
Short: "List available game maps",
|
|
Long: "List available game maps",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
for _, m := range maps.List() {
|
|
fmt.Println(m)
|
|
}
|
|
},
|
|
}
|
|
return listCmd
|
|
}
|