github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/command/v2/logout_command.go (about) 1 package v2 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 }