github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/v6/logout_command.go (about) 1 package v6 2 3 import ( 4 "code.cloudfoundry.org/cli/command" 5 ) 6 7 type LogoutCommand struct { 8 usage interface{} `usage:"CF_NAME logout"` 9 10 UI command.UI 11 Config command.Config 12 } 13 14 func (cmd *LogoutCommand) Setup(config command.Config, ui command.UI) error { 15 cmd.UI = ui 16 cmd.Config = config 17 return nil 18 } 19 20 func (cmd LogoutCommand) Execute(args []string) error { 21 user, err := cmd.Config.CurrentUser() 22 if err != nil { 23 return err 24 } 25 26 cmd.UI.DisplayText("Logging out {{.Username}}...", 27 map[string]interface{}{ 28 "Username": user.Name, 29 }) 30 cmd.Config.UnsetUserInformation() 31 cmd.UI.DisplayOK() 32 33 return nil 34 }