Skip to content

Commit f81000a

Browse files
authored
chore: Migrate to github.com/urfave/cli/v2 (#51)
1 parent 6ac3bb3 commit f81000a

File tree

202 files changed

+8951
-6743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+8951
-6743
lines changed

cmd/aoc-cli/main.go

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/briandowns/spinner"
1414
"github.com/manifoldco/promptui"
1515
log "github.com/obalunenko/logger"
16-
"github.com/urfave/cli"
16+
"github.com/urfave/cli/v2"
1717

1818
"github.com/obalunenko/advent-of-code/internal/puzzles"
1919
"github.com/obalunenko/advent-of-code/internal/puzzles/input"
@@ -34,17 +34,18 @@ func main() {
3434

3535
app := cli.NewApp()
3636
app.Name = "aoc-cli"
37-
3837
app.Description = "Solutions of puzzles for Advent Of Code (https://adventofcode.com/)\n" +
3938
"This command line tool contains solutions for puzzles and cli tool to run solutions to get " +
4039
"answers for input on site."
4140
app.Usage = `a command line tool for get solution for Advent of Code puzzles`
42-
app.Author = "Oleg Balunenko"
41+
app.Authors = []*cli.Author{
42+
{
43+
Name: "Oleg Balunenko",
44+
45+
},
46+
}
4347
app.Version = printVersion(ctx)
44-
app.Email = "[email protected]"
45-
4648
app.Flags = flags()
47-
4849
app.Action = menu(ctx)
4950
app.Before = printHeader
5051
app.After = onExit
@@ -69,26 +70,34 @@ func flags() []cli.Flag {
6970
var res []cli.Flag
7071

7172
elapsed := cli.BoolFlag{
72-
Name: fmt.Sprintf("%s, %s", flagElapsed, flagShortElapsed),
73+
Name: flagElapsed,
74+
Aliases: []string{flagShortElapsed},
7375
Usage: "Enables elapsed time metric",
74-
EnvVar: "",
76+
EnvVars: nil,
7577
FilePath: "",
7678
Required: false,
7779
Hidden: false,
80+
Value: false,
81+
DefaultText: "",
7882
Destination: nil,
83+
HasBeenSet: false,
7984
}
8085

8186
benchmark := cli.BoolFlag{
82-
Name: fmt.Sprintf("%s, %s", flagBenchmark, flagShortBenchmark),
87+
Name: flagBenchmark,
88+
Aliases: []string{flagShortBenchmark},
8389
Usage: "Enables benchmark metric",
84-
EnvVar: "",
90+
EnvVars: nil,
8591
FilePath: "",
8692
Required: false,
8793
Hidden: false,
94+
Value: false,
95+
DefaultText: "",
8896
Destination: nil,
97+
HasBeenSet: false,
8998
}
9099

91-
res = append(res, elapsed, benchmark)
100+
res = append(res, &elapsed, &benchmark)
92101

93102
return res
94103
}
@@ -230,11 +239,11 @@ func optionsFromCli(c *cli.Context) []puzzles.RunOption {
230239

231240
options := make([]puzzles.RunOption, 0, optsnum)
232241

233-
if c.GlobalBool(flagElapsed) || c.GlobalBool(flagShortElapsed) {
242+
if c.Bool(flagElapsed) || c.Bool(flagShortElapsed) {
234243
options = append(options, puzzles.WithElapsed())
235244
}
236245

237-
if c.GlobalBool(flagBenchmark) || c.GlobalBool(flagShortBenchmark) {
246+
if c.Bool(flagBenchmark) || c.Bool(flagShortBenchmark) {
238247
options = append(options, puzzles.WithBenchmark())
239248
}
240249

cmd/aoc-cli/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
log "github.com/obalunenko/logger"
1212
"github.com/obalunenko/version"
13-
"github.com/urfave/cli"
13+
"github.com/urfave/cli/v2"
1414
)
1515

1616
func printHeader(_ *cli.Context) error {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/obalunenko/logger v0.1.0
99
github.com/obalunenko/version v1.1.0
1010
github.com/stretchr/testify v1.7.0
11-
github.com/urfave/cli v1.22.5
11+
github.com/urfave/cli/v2 v2.3.0
1212
)
1313

1414
require (

go.sum

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
4545
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
4646
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
4747
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
48-
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
49-
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
48+
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
49+
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
5050
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5151
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5252
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5353
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3 h1:T6tyxxvHMj2L1R2kZg0uNMpS8ZhB9lRa9XRGTCSA65w=
5454
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5555
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5656
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
57-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
57+
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
5858
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
5959
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

tools/go.mod

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.17
55
require (
66
github.com/axw/gocov v1.0.0
77
github.com/golangci/golangci-lint v1.43.0
8-
github.com/goreleaser/goreleaser v0.184.0
8+
github.com/goreleaser/goreleaser v1.0.0
99
github.com/matm/gocov-html v0.0.0-20200509184451-71874e2e203b
1010
github.com/mattn/goveralls v0.0.11
1111
github.com/obalunenko/coverbadger v1.1.0
@@ -20,7 +20,7 @@ require (
2020
cloud.google.com/go/kms v0.1.0 // indirect
2121
cloud.google.com/go/storage v1.16.1 // indirect
2222
code.gitea.io/sdk/gitea v0.15.0 // indirect
23-
github.com/AlekSi/pointer v1.1.0 // indirect
23+
github.com/AlekSi/pointer v1.2.0 // indirect
2424
github.com/Antonboom/errname v0.1.5 // indirect
2525
github.com/Antonboom/nilnil v0.1.0 // indirect
2626
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
@@ -45,9 +45,10 @@ require (
4545
github.com/Masterminds/semver v1.5.0 // indirect
4646
github.com/Masterminds/semver/v3 v3.1.1 // indirect
4747
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
48-
github.com/Microsoft/go-winio v0.4.16 // indirect
48+
github.com/Microsoft/go-winio v0.5.0 // indirect
4949
github.com/OpenPeeDeeP/depguard v1.0.1 // indirect
5050
github.com/ProtonMail/go-crypto v0.0.0-20210512092938-c05353c2d58c // indirect
51+
github.com/acomagu/bufpipe v1.0.3 // indirect
5152
github.com/alecthomas/jsonschema v0.0.0-20211022214203-8b29eab41725 // indirect
5253
github.com/alexkohler/prealloc v1.0.0 // indirect
5354
github.com/apex/log v1.9.0 // indirect
@@ -80,7 +81,7 @@ require (
8081
github.com/cespare/xxhash/v2 v2.1.1 // indirect
8182
github.com/charithe/durationcheck v0.0.9 // indirect
8283
github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect
83-
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
84+
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
8485
github.com/daixiang0/gci v0.2.9 // indirect
8586
github.com/davecgh/go-spew v1.1.1 // indirect
8687
github.com/denis-tingajkin/go-header v0.4.2 // indirect
@@ -98,8 +99,8 @@ require (
9899
github.com/fzipp/gocyclo v0.3.1 // indirect
99100
github.com/go-critic/go-critic v0.6.1 // indirect
100101
github.com/go-git/gcfg v1.5.0 // indirect
101-
github.com/go-git/go-billy/v5 v5.1.0 // indirect
102-
github.com/go-git/go-git/v5 v5.3.0 // indirect
102+
github.com/go-git/go-billy/v5 v5.3.1 // indirect
103+
github.com/go-git/go-git/v5 v5.4.2 // indirect
103104
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
104105
github.com/go-toolsmith/astcast v1.0.0 // indirect
105106
github.com/go-toolsmith/astcopy v1.0.0 // indirect
@@ -126,15 +127,15 @@ require (
126127
github.com/google/go-cmp v0.5.6 // indirect
127128
github.com/google/go-github/v39 v39.2.0 // indirect
128129
github.com/google/go-querystring v1.1.0 // indirect
129-
github.com/google/rpmpack v0.0.0-20210410105602-e20c988a6f5a // indirect
130+
github.com/google/rpmpack v0.0.0-20210518075352-dc539ef4f2ea // indirect
130131
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
131132
github.com/google/uuid v1.3.0 // indirect
132133
github.com/google/wire v0.5.0 // indirect
133134
github.com/googleapis/gax-go/v2 v2.1.0 // indirect
134135
github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 // indirect
135136
github.com/goreleaser/chglog v0.1.2 // indirect
136137
github.com/goreleaser/fileglob v1.2.0 // indirect
137-
github.com/goreleaser/nfpm/v2 v2.6.0 // indirect
138+
github.com/goreleaser/nfpm/v2 v2.9.2 // indirect
138139
github.com/gorilla/websocket v1.4.2 // indirect
139140
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
140141
github.com/gostaticanalysis/comment v1.4.2 // indirect
@@ -147,7 +148,7 @@ require (
147148
github.com/hashicorp/go-version v1.2.1 // indirect
148149
github.com/hashicorp/hcl v1.0.0 // indirect
149150
github.com/huandu/xstrings v1.3.2 // indirect
150-
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
151+
github.com/iancoleman/orderedmap v0.2.0 // indirect
151152
github.com/imdario/mergo v0.3.12 // indirect
152153
github.com/inconshreveable/mousetrap v1.0.0 // indirect
153154
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -176,18 +177,17 @@ require (
176177
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
177178
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect
178179
github.com/mgechev/revive v1.1.2 // indirect
179-
github.com/mitchellh/copystructure v1.1.2 // indirect
180+
github.com/mitchellh/copystructure v1.2.0 // indirect
180181
github.com/mitchellh/go-homedir v1.1.0 // indirect
181182
github.com/mitchellh/mapstructure v1.4.2 // indirect
182-
github.com/mitchellh/reflectwalk v1.0.1 // indirect
183+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
183184
github.com/moricho/tparallel v0.2.1 // indirect
184185
github.com/nakabonne/nestif v0.3.1 // indirect
185186
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
186187
github.com/nishanths/exhaustive v0.2.3 // indirect
187188
github.com/nishanths/predeclared v0.2.1 // indirect
188189
github.com/obalunenko/version v1.1.0 // indirect
189190
github.com/olekukonko/tablewriter v0.0.5 // indirect
190-
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
191191
github.com/pelletier/go-toml v1.9.4 // indirect
192192
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect
193193
github.com/pkg/errors v0.9.1 // indirect
@@ -199,15 +199,13 @@ require (
199199
github.com/prometheus/procfs v0.6.0 // indirect
200200
github.com/quasilyte/go-ruleguard v0.3.13 // indirect
201201
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
202-
github.com/russross/blackfriday/v2 v2.0.1 // indirect
202+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
203203
github.com/ryancurrah/gomodguard v1.2.3 // indirect
204204
github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect
205205
github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect
206-
github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b // indirect
207206
github.com/securego/gosec/v2 v2.9.1 // indirect
208207
github.com/sergi/go-diff v1.2.0 // indirect
209208
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
210-
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
211209
github.com/sirupsen/logrus v1.8.1 // indirect
212210
github.com/sivchari/tenv v1.4.7 // indirect
213211
github.com/slack-go/slack v0.9.4 // indirect
@@ -236,13 +234,13 @@ require (
236234
github.com/uudashr/gocognit v1.0.5 // indirect
237235
github.com/vartanbeno/go-reddit/v2 v2.0.0 // indirect
238236
github.com/xanzy/go-gitlab v0.50.3 // indirect
239-
github.com/xanzy/ssh-agent v0.3.0 // indirect
237+
github.com/xanzy/ssh-agent v0.3.1 // indirect
240238
github.com/yeya24/promlinter v0.1.0 // indirect
241239
go.opencensus.io v0.23.0 // indirect
242240
gocloud.dev v0.24.0 // indirect
243241
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
244242
golang.org/x/mod v0.5.0 // indirect
245-
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
243+
golang.org/x/net v0.0.0-20211007125505-59d4e928ea9d // indirect
246244
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
247245
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
248246
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect

0 commit comments

Comments
 (0)