Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update urfave/cli to v2 #523

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
github.com/rancher/wrangler/v3 v3.2.0-rc.3
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.10.0
github.com/urfave/cli v1.22.16
github.com/urfave/cli/v2 v2.27.5
go.uber.org/mock v0.5.0
golang.org/x/sync v0.11.0
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
Expand Down Expand Up @@ -256,21 +255,16 @@ github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8w
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk=
github.com/urfave/cli v1.22.16 h1:MH0k6uJxdwdeWQTwhSO42Pwr4YLrNLwBtg1MRgTqPdQ=
github.com/urfave/cli v1.22.16/go.mod h1:EeJR6BKodywf4zciqrdw6hpCPk68JO9z5LazXZMn5Po=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/rancher/steve/pkg/version"
"github.com/rancher/wrangler/v3/pkg/signals"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var (
Expand Down
19 changes: 10 additions & 9 deletions pkg/auth/cli/webhookcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"time"

"github.com/rancher/steve/pkg/auth"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"k8s.io/client-go/tools/clientcmd"
)

Expand Down Expand Up @@ -49,24 +50,24 @@ func (w *WebhookConfig) WebhookMiddleware() (auth.Middleware, error) {

func Flags(config *WebhookConfig) []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "webhook-auth",
EnvVar: "WEBHOOK_AUTH",
EnvVars: []string{"WEBHOOK_AUTH"},
Destination: &config.WebhookAuthentication,
},
cli.StringFlag{
&cli.StringFlag{
Name: "webhook-kubeconfig",
EnvVar: "WEBHOOK_KUBECONFIG",
EnvVars: []string{"WEBHOOK_KUBECONFIG"},
Destination: &config.WebhookKubeconfig,
},
cli.StringFlag{
&cli.StringFlag{
Name: "webhook-url",
EnvVar: "WEBHOOK_URL",
EnvVars: []string{"WEBHOOK_URL"},
Destination: &config.WebhookURL,
},
cli.IntFlag{
&cli.IntFlag{
Name: "webhook-cache-ttl",
EnvVar: "WEBHOOK_CACHE_TTL",
EnvVars: []string{"WEBHOOK_CACHE_TTL"},
Destination: &config.CacheTTLSeconds,
},
}
Expand Down
27 changes: 4 additions & 23 deletions pkg/debug/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"fmt"

"github.com/sirupsen/logrus"
"github.com/urfave/cli"
cliv2 "github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
"k8s.io/klog"
)

Expand Down Expand Up @@ -46,34 +45,16 @@ func (c *Config) SetupDebug() error {

func Flags(config *Config) []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "debug",
Destination: &config.Debug,
},
cli.IntFlag{
&cli.IntFlag{
Name: "debug-level",
Value: 7,
Destination: &config.DebugLevel,
},
cli.BoolFlag{
Name: "sql-cache",
Destination: &config.SQLCache,
},
}
}

func FlagsV2(config *Config) []cliv2.Flag {
return []cliv2.Flag{
&cliv2.BoolFlag{
Name: "debug",
Destination: &config.Debug,
},
&cliv2.IntFlag{
Name: "debug-level",
Value: 7,
Destination: &config.DebugLevel,
},
&cliv2.BoolFlag{
&cli.BoolFlag{
Name: "sql-cache",
Destination: &config.SQLCache,
},
Expand Down
16 changes: 8 additions & 8 deletions pkg/server/cli/clicontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/rancher/steve/pkg/ui"
"github.com/rancher/wrangler/v3/pkg/kubeconfig"
"github.com/rancher/wrangler/v3/pkg/ratelimit"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

type Config struct {
Expand Down Expand Up @@ -57,26 +57,26 @@ func (c *Config) ToServer(ctx context.Context, sqlCache bool) (*server.Server, e

func Flags(config *Config) []cli.Flag {
flags := []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "kubeconfig",
EnvVar: "KUBECONFIG",
EnvVars: []string{"KUBECONFIG"},
Destination: &config.KubeConfig,
},
cli.StringFlag{
&cli.StringFlag{
Name: "context",
EnvVar: "CONTEXT",
EnvVars: []string{"CONTEXT"},
Destination: &config.Context,
},
cli.StringFlag{
&cli.StringFlag{
Name: "ui-path",
Destination: &config.UIPath,
},
cli.IntFlag{
&cli.IntFlag{
Name: "https-listen-port",
Value: 9443,
Destination: &config.HTTPSListenPort,
},
cli.IntFlag{
&cli.IntFlag{
Name: "http-listen-port",
Value: 9080,
Destination: &config.HTTPListenPort,
Expand Down
Loading