From 76966402daf1cf84349aa0e02c4acdd15631545d Mon Sep 17 00:00:00 2001 From: filip-debricked <135233582+filip-debricked@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:35:15 +0200 Subject: [PATCH] Move auth beta warning to subcommands runners (#265) --- internal/cmd/auth/auth.go | 3 --- internal/cmd/auth/login/login.go | 1 + internal/cmd/auth/logout/logout.go | 1 + internal/cmd/auth/token/token.go | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cmd/auth/auth.go b/internal/cmd/auth/auth.go index 8633ab4f..e17dd08f 100644 --- a/internal/cmd/auth/auth.go +++ b/internal/cmd/auth/auth.go @@ -1,8 +1,6 @@ package auth import ( - "log" - "github.com/debricked/cli/internal/auth" "github.com/debricked/cli/internal/cmd/auth/login" "github.com/debricked/cli/internal/cmd/auth/logout" @@ -21,7 +19,6 @@ func NewAuthCmd(authenticator auth.IAuthenticator) *cobra.Command { }, Hidden: true, } - log.Println("Warning: Authentication is beta and may not work as expected.") cmd.AddCommand(login.NewLoginCmd(authenticator)) cmd.AddCommand(logout.NewLogoutCmd(authenticator)) cmd.AddCommand(token.NewTokenCmd(authenticator)) diff --git a/internal/cmd/auth/login/login.go b/internal/cmd/auth/login/login.go index b2c697f2..4699f321 100644 --- a/internal/cmd/auth/login/login.go +++ b/internal/cmd/auth/login/login.go @@ -25,6 +25,7 @@ func NewLoginCmd(authenticator auth.IAuthenticator) *cobra.Command { func RunE(a auth.IAuthenticator) func(_ *cobra.Command, args []string) error { return func(cmd *cobra.Command, _ []string) error { + fmt.Println("Warning: auth is beta and may not work as expected.") err := a.Authenticate() if err != nil { return err diff --git a/internal/cmd/auth/logout/logout.go b/internal/cmd/auth/logout/logout.go index 840af21f..edc4a2af 100644 --- a/internal/cmd/auth/logout/logout.go +++ b/internal/cmd/auth/logout/logout.go @@ -25,6 +25,7 @@ func NewLogoutCmd(authenticator auth.IAuthenticator) *cobra.Command { func RunE(a auth.IAuthenticator) func(_ *cobra.Command, args []string) error { return func(cmd *cobra.Command, _ []string) error { + fmt.Println("Warning: auth is beta and may not work as expected.") err := a.Logout() if err != nil { return err diff --git a/internal/cmd/auth/token/token.go b/internal/cmd/auth/token/token.go index 44b4aa48..6e116f25 100644 --- a/internal/cmd/auth/token/token.go +++ b/internal/cmd/auth/token/token.go @@ -41,6 +41,7 @@ Format: func RunE(a auth.IAuthenticator) func(_ *cobra.Command, args []string) error { return func(cmd *cobra.Command, _ []string) error { + fmt.Println("Warning: auth is beta and may not work as expected.") token, err := a.Token() if err != nil { return err