package pflag

import (
	
	
	
)

// -- intSlice Value
type intSliceValue struct {
	value   *[]int
	changed bool
}

func newIntSliceValue( []int,  *[]int) *intSliceValue {
	 := new(intSliceValue)
	.value = 
	*.value = 
	return 
}

func ( *intSliceValue) ( string) error {
	 := strings.Split(, ",")
	 := make([]int, len())
	for ,  := range  {
		var  error
		[],  = strconv.Atoi()
		if  != nil {
			return 
		}

	}
	if !.changed {
		*.value = 
	} else {
		*.value = append(*.value, ...)
	}
	.changed = true
	return nil
}

func ( *intSliceValue) () string {
	return "intSlice"
}

func ( *intSliceValue) () string {
	 := make([]string, len(*.value))
	for ,  := range *.value {
		[] = fmt.Sprintf("%d", )
	}
	return "[" + strings.Join(, ",") + "]"
}

func ( *intSliceValue) ( string) error {
	,  := strconv.Atoi()
	if  != nil {
		return 
	}
	*.value = append(*.value, )
	return nil
}

func ( *intSliceValue) ( []string) error {
	 := make([]int, len())
	for ,  := range  {
		var  error
		[],  = strconv.Atoi()
		if  != nil {
			return 
		}
	}
	*.value = 
	return nil
}

func ( *intSliceValue) () []string {
	 := make([]string, len(*.value))
	for ,  := range *.value {
		[] = strconv.Itoa()
	}
	return 
}

func intSliceConv( string) (interface{}, error) {
	 = strings.Trim(, "[]")
	// Empty string would cause a slice with one (empty) entry
	if len() == 0 {
		return []int{}, nil
	}
	 := strings.Split(, ",")
	 := make([]int, len())
	for ,  := range  {
		var  error
		[],  = strconv.Atoi()
		if  != nil {
			return nil, 
		}

	}
	return , nil
}

// GetIntSlice return the []int value of a flag with the given name
func ( *FlagSet) ( string) ([]int, error) {
	,  := .getFlagType(, "intSlice", intSliceConv)
	if  != nil {
		return []int{}, 
	}
	return .([]int), nil
}

// IntSliceVar defines a intSlice flag with specified name, default value, and usage string.
// The argument p points to a []int variable in which to store the value of the flag.
func ( *FlagSet) ( *[]int,  string,  []int,  string) {
	.VarP(newIntSliceValue(, ), , "", )
}

// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
func ( *FlagSet) ( *[]int, ,  string,  []int,  string) {
	.VarP(newIntSliceValue(, ), , , )
}

// IntSliceVar defines a int[] flag with specified name, default value, and usage string.
// The argument p points to a int[] variable in which to store the value of the flag.
func ( *[]int,  string,  []int,  string) {
	CommandLine.VarP(newIntSliceValue(, ), , "", )
}

// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
func ( *[]int, ,  string,  []int,  string) {
	CommandLine.VarP(newIntSliceValue(, ), , , )
}

// IntSlice defines a []int flag with specified name, default value, and usage string.
// The return value is the address of a []int variable that stores the value of the flag.
func ( *FlagSet) ( string,  []int,  string) *[]int {
	 := []int{}
	.IntSliceVarP(&, , "", , )
	return &
}

// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
func ( *FlagSet) (,  string,  []int,  string) *[]int {
	 := []int{}
	.IntSliceVarP(&, , , , )
	return &
}

// IntSlice defines a []int flag with specified name, default value, and usage string.
// The return value is the address of a []int variable that stores the value of the flag.
func ( string,  []int,  string) *[]int {
	return CommandLine.IntSliceP(, "", , )
}

// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
func (,  string,  []int,  string) *[]int {
	return CommandLine.IntSliceP(, , , )
}