forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_command1.go
44 lines (35 loc) · 1.16 KB
/
fake_command1.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 fake_command
import (
"fmt"
"github.com/cloudfoundry/cli/cf/command_registry"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/flags"
"github.com/cloudfoundry/cli/flags/flag"
)
type FakeCommand1 struct {
Data string
}
func init() {
command_registry.Register(FakeCommand1{Data: "FakeCommand1 data"})
}
func (cmd FakeCommand1) MetaData() command_registry.CommandMetadata {
fs := make(map[string]flags.FlagSet)
fs["boolFlag"] = &cliFlags.BoolFlag{Name: "BoolFlag", Usage: "Usage for BoolFlag"}
fs["intFlag"] = &cliFlags.IntFlag{Name: "intFlag", Usage: "Usage for intFlag"}
return command_registry.CommandMetadata{
Name: "fake-command",
ShortName: "fc1",
Description: "Description for fake-command",
Usage: "Usage of fake-command",
Flags: fs,
}
}
func (cmd FakeCommand1) Requirements(_ requirements.Factory, _ flags.FlagContext) (reqs []requirements.Requirement, err error) {
return
}
func (cmd FakeCommand1) SetDependency(deps command_registry.Dependency, _ bool) command_registry.Command {
return cmd
}
func (cmd FakeCommand1) Execute(c flags.FlagContext) {
fmt.Println("This is fake-command")
}