Back to godoc.org
leb.io/hrff

package hrff

v0.0.0 (db15487)
Latest Go to latest
Published: Nov 10, 2019 | License: MIT | Module: leb.io/hrff

Overview

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

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

func AddSkip(sip string, b bool)

AddSkip adds a skip

func Classic

func Classic()

Classic is what life was like before SI

func NoSkips

func NoSkips()

NoSkips gets rid of all the skips

func RemoveNominal

func RemoveNominal()

RemoveNominal removes unoffice suffixes

func UseHella

func UseHella()

UseHella allows use of H over bronto

type Float64

type Float64 struct {
	V float64
	U string
}

Float64 is a version of float64 with a unit

func (Float64) Format

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

func (*Float64) Set

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

func (Float64) String

func (v Float64) String() string

type Int

type Int struct {
	V int
	U string
}

Int is a version of int with a unit

func (Int) Format

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

func (*Int) Set

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

func (Int) String

func (v Int) String() string

type Int64

type Int64 struct {
	V int64
	U string
}

Int64 is a version of int64 with a unit

func (Int64) Format

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

func (*Int64) Set

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

func (v Int64) String() string
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier