Skip to content

Commit

Permalink
feat: added Get opt arg for int32 & int64 args
Browse files Browse the repository at this point in the history
  • Loading branch information
alfarih31 committed Jan 3, 2022
1 parent 0f3a62d commit e102a9d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@ func GetOptIntArg(opts []int, defaultValue ...int) int {
return o
}

func GetOptInt32Arg(opts []int32, defaultValue ...int32) int32 {
var o int32 = 0
if len(defaultValue) > 0 {
o = defaultValue[0]
}

if len(opts) > 0 {
o = opts[0]
}

return o
}

func GetOptInt64Arg(opts []int64, defaultValue ...int64) int64 {
var o int64 = 0
if len(defaultValue) > 0 {
o = defaultValue[0]
}

if len(opts) > 0 {
o = opts[0]
}

return o
}

func GetOptBoolArg(opts []bool, defaultValue ...bool) bool {
var o = false
if len(defaultValue) > 0 {
Expand Down

0 comments on commit e102a9d

Please # to comment.