github.com/goravel/framework@v1.13.9/contracts/console/command.go (about) 1 package console 2 3 import ( 4 "github.com/goravel/framework/contracts/console/command" 5 ) 6 7 type Command interface { 8 // Signature set the unique signature for the command. 9 Signature() string 10 // Description the console command description. 11 Description() string 12 // Extend the console command extend. 13 Extend() command.Extend 14 // Handle execute the console command. 15 Handle(ctx Context) error 16 } 17 18 //go:generate mockery --name=Context 19 type Context interface { 20 // Argument get the value of a command argument. 21 Argument(index int) string 22 // Arguments get all the arguments passed to command. 23 Arguments() []string 24 // Option gets the value of a command option. 25 Option(key string) string 26 // OptionSlice looks up the value of a local StringSliceFlag, returns nil if not found 27 OptionSlice(key string) []string 28 // OptionBool looks up the value of a local BoolFlag, returns false if not found 29 OptionBool(key string) bool 30 // OptionFloat64 looks up the value of a local Float64Flag, returns zero if not found 31 OptionFloat64(key string) float64 32 // OptionFloat64Slice looks up the value of a local Float64SliceFlag, returns nil if not found 33 OptionFloat64Slice(key string) []float64 34 // OptionInt looks up the value of a local IntFlag, returns zero if not found 35 OptionInt(key string) int 36 // OptionIntSlice looks up the value of a local IntSliceFlag, returns nil if not found 37 OptionIntSlice(key string) []int 38 // OptionInt64 looks up the value of a local Int64Flag, returns zero if not found 39 OptionInt64(key string) int64 40 // OptionInt64Slice looks up the value of a local Int64SliceFlag, returns nil if not found 41 OptionInt64Slice(key string) []int64 42 }