Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flag ¶
type Flag struct {
// contains filtered or unexported fields
}
Flag satisfies the pflag.Value interface
func NewFlag ¶
NewFlag is used to initialise a new iecbyte.Flag with a default value
A value of n that is < 0 will be set to 0
Example ¶
package main
import (
"flag"
"fmt"
"github.com/andrewheberle/iecbyte"
)
func main() {
size := iecbyte.NewFlag(1024 * 1024)
flag.Var(&size, "size", "Size in IEC bytes")
//
// In this example flag.Parse() is commented out as this forms part of the tests
// of this module, so parsing the command line flags is disabled.
//
// In a real program you would need to call flag.Parse()
//
// flag.Parse()
fmt.Printf("Size is %s\n", size)
}
Output: Size is 1Mi
Click to show internal directories.
Click to hide internal directories.