Debian Codegraph @

flag_int.go

raw symbols SCIP
1 package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/
2
3 import (
4 "strconvscip-go gomod github.com/golang/go/src go1.22 strconv/"
5 "unsafescip-go gomod github.com/golang/go/src go1.22 unsafe/"
6 )
7
8 type (
9 IntFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntFlag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[int, IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#, intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[int]]
10 Int8Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int8Flag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[int8, IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#, intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[int8]]
11 Int16Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int16Flag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[int16, IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#, intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[int16]]
12 Int32Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int32Flag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[int32, IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#, intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[int32]]
13 Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag# = FlagBasescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#[int64, IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#, intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[int64]]
14 )
15
16 // IntegerConfig is the configuration for all integer type flags
17 type IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig# struct {
18 Basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#Base. int
19 }
20
21 // -- int Value
22 type intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T int | int8 | int16 | int32 | int64] struct {
23 valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val. *T
24 basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#base. int
25 }
26
27 // Below functions are to satisfy the ValueCreator interface
28
29 func (i intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]) Createscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#Create().(val T, p *T, c IntegerConfigscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#) Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Value# {
30 *p = val
31
32 return &intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]{
33 valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val.: p,
34 basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#base.: c.Basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/IntegerConfig#Base.,
35 }
36 }
37
38 func (i intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]) ToStringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#ToString().(b T) string {
39 i.valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val. = &b
40 return i.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#String().()
41 }
42
43 // Below functions are to satisfy the flag.Value interface
44
45 func (i *intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]) Setscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#Set().(s string) error {
46 v, err := strconvscip-go gomod github.com/golang/go/src go1.22 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.22 strconv/ParseInt().(s, i.basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#base., int(unsafescip-go gomod github.com/golang/go/src go1.22 unsafe/.Sizeof(T(0))*8))
47 if err != nil {
48 return err
49 }
50 *i.valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val. = T(v)
51 return err
52 }
53
54 func (i *intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]) Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#Get().() any { return *i.valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val. }
55
56 func (i *intValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#[T]) Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#String().() string {
57 base := i.basescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#base.
58 if base == 0 {
59 base = 10
60 }
61
62 return strconvscip-go gomod github.com/golang/go/src go1.22 strconv/.FormatIntscip-go gomod github.com/golang/go/src go1.22 strconv/FormatInt().(int64(*i.valscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/intValue#val.), base)
63 }
64
65 // Int looks up the value of a local Int64Flag, returns
66 // 0 if not found
67 func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Intscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int().(name string) int {
68 return getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[int](cmd, name)
69 }
70
71 // Int8 looks up the value of a local Int8Flag, returns
72 // 0 if not found
73 func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Int8scip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int8().(name string) int8 {
74 return getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[int8](cmd, name)
75 }
76
77 // Int16 looks up the value of a local Int16Flag, returns
78 // 0 if not found
79 func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Int16scip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int16().(name string) int16 {
80 return getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[int16](cmd, name)
81 }
82
83 // Int32 looks up the value of a local Int32Flag, returns
84 // 0 if not found
85 func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Int32scip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int32().(name string) int32 {
86 return getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[int32](cmd, name)
87 }
88
89 // Int64 looks up the value of a local Int64Flag, returns
90 // 0 if not found
91 func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) Int64scip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Int64().(name string) int64 {
92 return getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[int64](cmd, name)
93 }
94
95 func getIntscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/getInt().[T int | int8 | int16 | int32 | int64](cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#, name string) T {
96 if v, ok := cmd.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Value().(name).(T); ok {
97 tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("int available for flag name %[1]q with value=%[2]v (cmd=%[3]q)", name, v, cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.)
98
99 return v
100 }
101
102 tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("int NOT available for flag name %[1]q (cmd=%[2]q)", name, cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.)
103 return 0
104 }