github.com/rakutentech/cli@v6.12.5-0.20151006231303-24468b65536e+incompatible/cf/command_registry/fake_command/fake_command1.go (about) 1 package fake_command 2 3 import ( 4 "fmt" 5 6 "github.com/cloudfoundry/cli/cf/command_registry" 7 "github.com/cloudfoundry/cli/cf/requirements" 8 "github.com/cloudfoundry/cli/flags" 9 "github.com/cloudfoundry/cli/flags/flag" 10 ) 11 12 type FakeCommand1 struct { 13 Data string 14 } 15 16 func init() { 17 command_registry.Register(FakeCommand1{Data: "FakeCommand1 data"}) 18 } 19 20 func (cmd FakeCommand1) MetaData() command_registry.CommandMetadata { 21 fs := make(map[string]flags.FlagSet) 22 fs["f"] = &cliFlags.BoolFlag{Name: "f", Usage: "Usage for BoolFlag"} 23 fs["boolFlag"] = &cliFlags.BoolFlag{Name: "BoolFlag", Usage: "Usage for BoolFlag"} 24 fs["intFlag"] = &cliFlags.IntFlag{Name: "intFlag", Usage: "Usage for intFlag"} 25 26 return command_registry.CommandMetadata{ 27 Name: "fake-command", 28 ShortName: "fc1", 29 Description: "Description for fake-command", 30 Usage: "CF_NAME Usage of fake-command", 31 Flags: fs, 32 } 33 } 34 35 func (cmd FakeCommand1) Requirements(_ requirements.Factory, _ flags.FlagContext) (reqs []requirements.Requirement, err error) { 36 return 37 } 38 39 func (cmd FakeCommand1) SetDependency(deps command_registry.Dependency, _ bool) command_registry.Command { 40 return cmd 41 } 42 43 func (cmd FakeCommand1) Execute(c flags.FlagContext) { 44 fmt.Println("This is fake-command") 45 }