forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logout.go
44 lines (37 loc) · 1.08 KB
/
logout.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package commands
import (
"github.com/cloudfoundry/cli/cf/command_registry"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
. "github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/terminal"
"github.com/cloudfoundry/cli/flags"
)
type Logout struct {
ui terminal.UI
config core_config.ReadWriter
}
func init() {
command_registry.Register(&Logout{})
}
func (cmd *Logout) MetaData() command_registry.CommandMetadata {
return command_registry.CommandMetadata{
Name: "logout",
ShortName: "lo",
Description: T("Log user out"),
Usage: T("CF_NAME logout"),
}
}
func (cmd *Logout) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) (reqs []requirements.Requirement, err error) {
return
}
func (cmd *Logout) SetDependency(deps command_registry.Dependency, _ bool) command_registry.Command {
cmd.ui = deps.Ui
cmd.config = deps.Config
return cmd
}
func (cmd *Logout) Execute(c flags.FlagContext) {
cmd.ui.Say(T("Logging out..."))
cmd.config.ClearSession()
cmd.ui.Ok()
}