diff options
author | Eirik Nygaard <eirik.nygaard@yahooinc.com> | 2022-03-11 14:42:10 +0100 |
---|---|---|
committer | Eirik Nygaard <eirik.nygaard@yahooinc.com> | 2022-03-11 14:56:12 +0100 |
commit | 0fd92f1a5e53267b9108860d3c7d58f5b55e32d4 (patch) | |
tree | 61899100d8b37b7dfa87cc2dc303ca8919f44bac /client/go | |
parent | 05ec8177b4fa81d9c5bdab16d01b346709e31fd5 (diff) |
Move Logout functionality to cmd package to match new Login structure
Diffstat (limited to 'client/go')
-rw-r--r-- | client/go/auth/auth0/auth0.go | 19 | ||||
-rw-r--r-- | client/go/cmd/logout.go | 12 |
2 files changed, 11 insertions, 20 deletions
diff --git a/client/go/auth/auth0/auth0.go b/client/go/auth/auth0/auth0.go index 593489600d1..9b24066fa04 100644 --- a/client/go/auth/auth0/auth0.go +++ b/client/go/auth/auth0/auth0.go @@ -252,7 +252,7 @@ func (a *Auth0) AddSystem(s *System) error { return nil } -func (a *Auth0) removeSystem(s string) error { +func (a *Auth0) RemoveSystem(s string) error { _ = a.init() // If we're dealing with an empty file, we'll need to initialize this map. @@ -345,20 +345,3 @@ func (a *Auth0) initContext() (err error) { a.config = *cfg return nil } - -func RunLogout(a *Auth0) error { - s, err := a.getSystem() - if err != nil { - return err - } - - if err := a.removeSystem(s.Name); err != nil { - return err - } - - fmt.Print("\n") - fmt.Println("Successfully logged out.") - fmt.Print("\n") - - return nil -} diff --git a/client/go/cmd/logout.go b/client/go/cmd/logout.go index 6cef5ee371c..c0a6b60ab2e 100644 --- a/client/go/cmd/logout.go +++ b/client/go/cmd/logout.go @@ -1,6 +1,8 @@ package cmd import ( + "log" + "github.com/spf13/cobra" "github.com/vespa-engine/vespa/client/go/auth/auth0" ) @@ -26,8 +28,14 @@ func newLogoutCmd(cli *CLI) *cobra.Command { if err != nil { return err } - err = auth0.RunLogout(a) - return err + if err := a.RemoveSystem(system.Name); err != nil { + return err + } + + log.Print("\n") + log.Println("Successfully logged out.") + log.Print("\n") + return nil }, } } |