pflag-decimal
implements a Golang pflag.Value
interface decimal values.
Combining github.com/spf13/pflag with github.com/shopspring/decimal.
This facilitiates command-line argument handling of date parameters such --value=123.45
.
go get github.com/gbarr/pflag-decimal
https://pkg.go.dev/github.com/gbarr/pflag-decimal
package main
import (
"fmt"
pfdecimal "github.com/gbarr/pflag-decimal"
"github.com/spf13/pflag"
)
func main() {
var dec pfdecimal.Decimal
pflag.VarP(&dec, "value", "v", "decimal value")
pflag.Parse()
fmt.Println("value:", dec.String())
}
Copyright (c) 2024 Graham Barr.
Released under the MIT License, see LICENSE.