refactor: urfave v3

This commit is contained in:
2024-07-09 13:57:54 +02:00
parent 375e17a4a0
commit 1f8662cd95
336 changed files with 7332 additions and 25145 deletions
cli
go.modgo.sum
pkg/autocomplete
scripts/autocomplete
vendor
github.com
Azure
ProtonMail
beorn7
perks
quantile
cenkalti
containers
cpuguy83
davecgh
docker
emirpasic
gods
containers
lists
arraylist
utils
felixge
ghodss
go-git
gogo
google
hashicorp
go-cleanhttp
kballard
go-shellquote
kevinburke
ssh_config
lucasb-eyer
go-colorful
mattn
mgutz
ansi
miekg
pkcs11
opencontainers
pkg
pmezard
go-difflib
difflib
russross
sergi
go-diff
diffmatchpatch
sirupsen
spf13
theupdateframework
urfave
xeipuuv
xrash
go.opentelemetry.io
proto
otlp
metrics
trace
golang.org
x
sys
text
internal
language
language
google.golang.org
protobuf
internal
gopkg.in
gotest.tools
v3
internal
difflib
modules.txt

48
vendor/github.com/urfave/cli/v3/flag_float.go generated vendored Normal file

@ -0,0 +1,48 @@
package cli
import (
"strconv"
)
type FloatFlag = FlagBase[float64, NoConfig, floatValue]
// -- float64 Value
type floatValue float64
// Below functions are to satisfy the ValueCreator interface
func (f floatValue) Create(val float64, p *float64, c NoConfig) Value {
*p = val
return (*floatValue)(p)
}
func (f floatValue) ToString(b float64) string {
return strconv.FormatFloat(b, 'g', -1, 64)
}
// Below functions are to satisfy the flag.Value interface
func (f *floatValue) Set(s string) error {
v, err := strconv.ParseFloat(s, 64)
if err != nil {
return err
}
*f = floatValue(v)
return err
}
func (f *floatValue) Get() any { return float64(*f) }
func (f *floatValue) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
// Float looks up the value of a local FloatFlag, returns
// 0 if not found
func (cmd *Command) Float(name string) float64 {
if v, ok := cmd.Value(name).(float64); ok {
tracef("float available for flag name %[1]q with value=%[2]v (cmd=%[3]q)", name, v, cmd.Name)
return v
}
tracef("float NOT available for flag name %[1]q (cmd=%[2]q)", name, cmd.Name)
return 0
}