hrff: leb.io/hrff Index | Files

package hrff

import "leb.io/hrff"

Package hrff (Human Readbale Flags and Formatting) Allows command line arguments like % dd bs=1Mi Provides SI unit formatting via %h and %H format characters Defines two news types, Int64 and Float64 which provide methods for flags to accept these kind of args

Index

Package Files

hrff.go

Variables

var SIsufixes = map[string]float64{

    "geop":   10000000000000000000000000000000,
    "bronto": 10000000000000000000000000000,
    "Y":      1000000000000000000000000,
    "Z":      1000000000000000000000,
    "E":      1000000000000000000,
    "P":      1000000000000000,
    "T":      1000000000000,
    "G":      1000000000,
    "M":      1000000,

    "k":  1000,
    "h":  100,
    "da": 10,
    "":   1,
    "d":  .1,
    "c":  .01,
    "m":  .001,
    "µ":  .000001,
    "n":  .000000001,
    "p":  .00000000001,
    "f":  .000000000000001,
    "a":  .000000000000000001,
    "z":  .000000000000000000001,
    "y":  .000000000000000000000001,

    "u": .000001,

    "Ki": 1024,
    "Mi": 1024 * 1024,
    "Gi": 1024 * 1024 * 1024,
    "Ti": 1024 * 1024 * 1024 * 1024,
    "Pi": 1024 * 1024 * 1024 * 1024 * 1024,
    "Ei": 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
    "Zi": 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
    "Yi": 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
}

SIsufixes is public so you can add a prefix if you want to

func AddSkip Uses

func AddSkip(sip string, b bool)

AddSkip adds a skip

func Classic Uses

func Classic()

Classic is what life was like before SI

func NoSkips Uses

func NoSkips()

NoSkips gets rid of all the skips

func RemoveNominal Uses

func RemoveNominal()

RemoveNominal removes unoffice suffixes

func UseHella Uses

func UseHella()

UseHella allows use of H over bronto

type Float64 Uses

type Float64 struct {
    V   float64
    U   string
}

Float64 is a version of float64 with a unit

func (Float64) Format Uses

func (v Float64) Format(s fmt.State, c rune)

func (*Float64) Set Uses

func (r *Float64) Set(s string) error

func (Float64) String Uses

func (v Float64) String() string

type Int Uses

type Int struct {
    V   int
    U   string
}

Int is a version of int with a unit

func (Int) Format Uses

func (v Int) Format(s fmt.State, c rune)

func (*Int) Set Uses

func (r *Int) Set(s string) error

func (Int) String Uses

func (v Int) String() string

type Int64 Uses

type Int64 struct {
    V   int64
    U   string
}

Int64 is a version of int64 with a unit

func (Int64) Format Uses

func (v Int64) Format(s fmt.State, c rune)

func (*Int64) Set Uses

func (r *Int64) Set(s string) error

FIX FIX FIX check ok or err? if no prefix we must convert anyway not err

func (Int64) String Uses

func (v Int64) String() string

Package hrff imports 2 packages (graph) and is imported by 25 packages. Updated 2019-12-17. Refresh now. Tools for package owners.