File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,20 @@ func startGame(themes []Theme, presets []preset.Preset) error {
61
61
return game .Loop ()
62
62
}
63
63
64
+ func listPresets (c * cli.Context , presets []preset.Preset ) error {
65
+ for _ , preset := range presets {
66
+ fmt .Println (preset .Name )
67
+ }
68
+ return nil
69
+ }
70
+
71
+ func listThemes (c * cli.Context , themes []Theme ) error {
72
+ for _ , theme := range themes {
73
+ fmt .Println (theme .Name )
74
+ }
75
+ return nil
76
+ }
77
+
64
78
func main () {
65
79
presets , err := preset .LoadPresets ()
66
80
if err != nil {
@@ -81,6 +95,23 @@ func main() {
81
95
app .Usage = "Conway's Game of Life"
82
96
app .Version = "0.2.0"
83
97
98
+ app .Commands = []cli.Command {
99
+ {
100
+ Name : "themes" ,
101
+ Usage : "list themes" ,
102
+ Action : func (c * cli.Context ) error {
103
+ return listThemes (c , themes )
104
+ },
105
+ },
106
+ {
107
+ Name : "presets" ,
108
+ Usage : "list presets" ,
109
+ Action : func (c * cli.Context ) error {
110
+ return listPresets (c , presets )
111
+ },
112
+ },
113
+ }
114
+
84
115
app .Action = func (c * cli.Context ) error {
85
116
return startGame (themes , presets )
86
117
}
You can’t perform that action at this time.
0 commit comments