github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/cf/commandregistry/fakecommand/fake_command1.go (about) 1 package fakecommand 2 3 import ( 4 "fmt" 5 6 "github.com/liamawhite/cli-with-i18n/cf/commandregistry" 7 "github.com/liamawhite/cli-with-i18n/cf/flags" 8 "github.com/liamawhite/cli-with-i18n/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 }