github.com/goravel/framework@v1.13.9/console/cli_context.go (about)

     1  package console
     2  
     3  import (
     4  	"github.com/urfave/cli/v2"
     5  )
     6  
     7  type CliContext struct {
     8  	instance *cli.Context
     9  }
    10  
    11  func (r *CliContext) Argument(index int) string {
    12  	return r.instance.Args().Get(index)
    13  }
    14  
    15  func (r *CliContext) Arguments() []string {
    16  	return r.instance.Args().Slice()
    17  }
    18  
    19  func (r *CliContext) Option(key string) string {
    20  	return r.instance.String(key)
    21  }
    22  
    23  func (r *CliContext) OptionSlice(key string) []string {
    24  	return r.instance.StringSlice(key)
    25  }
    26  
    27  func (r *CliContext) OptionBool(key string) bool {
    28  	return r.instance.Bool(key)
    29  }
    30  
    31  func (r *CliContext) OptionFloat64(key string) float64 {
    32  	return r.instance.Float64(key)
    33  }
    34  
    35  func (r *CliContext) OptionFloat64Slice(key string) []float64 {
    36  	return r.instance.Float64Slice(key)
    37  }
    38  
    39  func (r *CliContext) OptionInt(key string) int {
    40  	return r.instance.Int(key)
    41  }
    42  
    43  func (r *CliContext) OptionIntSlice(key string) []int {
    44  	return r.instance.IntSlice(key)
    45  }
    46  
    47  func (r *CliContext) OptionInt64(key string) int64 {
    48  	return r.instance.Int64(key)
    49  }
    50  
    51  func (r *CliContext) OptionInt64Slice(key string) []int64 {
    52  	return r.instance.Int64Slice(key)
    53  }