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