Skip to content
Merged
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
3 changes: 2 additions & 1 deletion cmd/servicetoken/servicetoken_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/stackvista/stackstate-cli/generated/stackstate_api"
"github.com/stackvista/stackstate-cli/internal/common"
"github.com/stackvista/stackstate-cli/internal/di"
"github.com/stackvista/stackstate-cli/pkg/pflags"
)

const (
Expand Down Expand Up @@ -37,7 +38,7 @@ sts service-token create --name my-token --roles stackstate-power-user --expirat
}

common.AddRequiredNameFlagVar(cmd, &args.Name, "Name of the service token")
cmd.Flags().TimeVar(&args.Expiration, "expiration", time.Time{}, []string{DateFormat}, "Expiration date of the service token")
pflags.TimeVar(cmd.Flags(), &args.Expiration, "expiration", time.Time{}, DateFormat, "Expiration date of the service token")
cmd.Flags().StringSliceVar(&args.Roles, "roles", []string{}, "Roles assigned to the service token")
cmd.Flags().StringVar(&args.DedicatedSubject, "dedicatedSubject", "", "Subject solely created for usage with this token. The dedicated subject is cleaned after the token is deleted")
cmd.MarkFlagRequired("roles") //nolint:errcheck
Expand Down
4 changes: 2 additions & 2 deletions cmd/servicetoken/servicetoken_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ func checkCreateCall(t *testing.T, calls *[]stackstate_api.CreateNewServiceToken
}

func TestServiceTokenCreateWithoutColor(t *testing.T) {
colorEnabled := color.Disable()
t.Cleanup(func() { color.Enable = colorEnabled })
cli := di.NewMockDeps(t)
cmd := CreateCommand(&cli.Deps)
colorEnabled := color.Disable()
t.Cleanup(func() { color.Enable = colorEnabled })
cli.MockClient.ApiMocks.ServiceTokenApi.CreateNewServiceTokenResponse.Result = stackstate_api.ServiceTokenCreatedResponse{
Name: "test-token",
Token: "test-token-token",
Expand Down
47 changes: 21 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ module github.com/stackvista/stackstate-cli

go 1.26.11

replace github.com/spf13/pflag => github.com/stackvista/pflag v1.22.0

require (
github.com/alecthomas/chroma v0.10.0
github.com/gookit/color v1.6.0
github.com/jedib0t/go-pretty/v6 v6.5.9
github.com/gookit/color v1.6.3
github.com/jedib0t/go-pretty/v6 v6.9.1
github.com/mitchellh/go-homedir v1.1.0
github.com/pterm/pterm v0.12.84
github.com/rs/zerolog v1.32.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.11.1
golang.org/x/oauth2 v0.37.0
github.com/rs/zerolog v1.35.1
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.12.1
golang.org/x/oauth2 v0.38.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/blang/semver/v4 v4.0.0
github.com/mattn/go-runewidth v0.0.31
github.com/mcuadros/go-defaults v1.2.0
github.com/spf13/pflag v1.0.10
golang.org/x/text v0.43.0
github.com/spf13/pflag v1.1.0
golang.org/x/text v0.44.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/kubectl v0.29.15
)

require github.com/rivo/uniseg v0.4.7 // indirect

require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
Expand Down Expand Up @@ -86,36 +86,31 @@ require (
github.com/containerd/console v1.0.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/sync v0.24.0 // indirect
golang.org/x/sync v0.25.0 // indirect
golang.org/x/sys v0.49.0 // indirect
golang.org/x/term v0.47.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading