Skip to content

Commit 55d8ee5

Browse files
author
Takumasa Sakao
committed
Use urface/cli
1 parent a9bab0d commit 55d8ee5

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/mattn/go-runewidth v0.0.3 // indirect
1111
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
1212
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
13+
github.com/urfave/cli v1.20.0
1314
golang.org/x/text v0.3.0 // indirect
1415
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
1516
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
2929
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
3030
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
3131
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
32+
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
33+
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
3234
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f h1:QM2QVxvDoW9PFSPp/zy9FgxJLfaWTZlS61KEPtBwacM=
3335
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
3436
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=

main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/gdamore/tcell"
1010
"github.com/gdamore/tcell/encoding"
1111
"github.com/sachaos/go-life/preset"
12+
"github.com/urfave/cli"
1213
)
1314

1415
func initScreen() tcell.Screen {
@@ -75,7 +76,16 @@ func main() {
7576
ThemeWhiteAndBlack,
7677
}
7778

78-
if err := startGame(themes, presets); err != nil {
79+
app := cli.NewApp()
80+
app.Name = "go-life"
81+
app.Usage = "Conway's Game of Life"
82+
app.Version = "0.2.0"
83+
84+
app.Action = func(c *cli.Context) error {
85+
return startGame(themes, presets)
86+
}
87+
88+
if err := app.Run(os.Args); err != nil {
7989
fmt.Fprintf(os.Stderr, err.Error())
8090
os.Exit(1)
8191
}

0 commit comments

Comments
 (0)