Skip to content

Commit

Permalink
Move auth beta warning to subcommands runners (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-debricked authored Sep 20, 2024
1 parent 29d48db commit 7696640
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions internal/cmd/auth/auth.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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))
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/auth/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/auth/logout/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/auth/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7696640

Please sign in to comment.