Skip to content

Commit

Permalink
cmd: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Sep 9, 2024
1 parent 46bd9e5 commit c50fa6e
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions internal/cmd/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,18 @@ var _ flag.Value = (*intSliceValue)(nil)

// Set implements the [flag.Value] interface for *intSliceValue.
func (i *intSliceValue) Set(s string) (err error) {
values := strings.Split(s, ",")

var intVal int64
for _, v := range values {
intVal, err = strconv.ParseInt(v, 0, 32)
if err != nil {
return fmt.Errorf("parsing integer slice arg %q: %w", s, err)
}

if !i.isSet {
i.isSet = true
*i.values = []int{}
}
intVal, err := strconv.ParseInt(s, 0, 32)
if err != nil {
return fmt.Errorf("parsing integer slice arg %q: %w", s, err)
}

*i.values = append(*i.values, int(intVal))
if !i.isSet {
i.isSet = true
*i.values = []int{}
}

*i.values = append(*i.values, int(intVal))

return nil
}

Expand Down

0 comments on commit c50fa6e

Please sign in to comment.