Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.55 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.55 KB

pflag-decimal

Go Reference codecov Go ReportCard golangci-lint

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.

Documentation

go get github.com/gbarr/pflag-decimal

https://pkg.go.dev/github.com/gbarr/pflag-decimal

Example

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())
}

Credits and License

Copyright (c) 2024 Graham Barr.

Released under the MIT License, see LICENSE.