forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logout.go
48 lines (41 loc) · 1.13 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
45
46
47
48
package commands
import (
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
"github.com/cloudfoundry/cli/cf/flags"
. "github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/terminal"
)
type Logout struct {
ui terminal.UI
config coreconfig.ReadWriter
}
func init() {
commandregistry.Register(&Logout{})
}
func (cmd *Logout) MetaData() commandregistry.CommandMetadata {
return commandregistry.CommandMetadata{
Name: "logout",
ShortName: "lo",
Description: T("Log user out"),
Usage: []string{
T("CF_NAME logout"),
},
}
}
func (cmd *Logout) Requirements(requirementsFactory requirements.Factory, fc flags.FlagContext) []requirements.Requirement {
reqs := []requirements.Requirement{}
return reqs
}
func (cmd *Logout) SetDependency(deps commandregistry.Dependency, _ bool) commandregistry.Command {
cmd.ui = deps.UI
cmd.config = deps.Config
return cmd
}
func (cmd *Logout) Execute(c flags.FlagContext) error {
cmd.ui.Say(T("Logging out..."))
cmd.config.ClearSession()
cmd.ui.Ok()
return nil
}