ask

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 17 Imported by: 36

README

Ask

Ask is a small CLI building package for Go, which enables you to define commands as data-types, without requiring full initialization upfront. This makes it suitable for shell applications, and CLIs with dynamic commands or just too many to load at once. Ask is composable and open, it is designed for highly re-usable flags, flag-groups and command extensibility.

In addition to common Go basic types, some special array/slice types are supported:

  • [](u)int(8/16/32/64): integer slices
  • []string: string slices (with CSV-like delimiter decoding, thanks pflag for the idea)
  • net.IP, net.IPMask, net.IPNet: common networking flags
  • []byte as hex-encoded string, case-insensitive, optional 0x prefix and padding
  • [N]byte, same as above, but an array
  • [][N]byte, a comma-separated list of elements, each formatted like the above.

Note: flags in between command parts, e.g. peer --foobar connect are not supported, but may be in the future.

Flags

Each flag and (optional) argument is declared as a struct-field in a command. Commands can be composed of different structs, inlined or grouped. Ask is designed to make command options as reusable as possible.

Struct tags:

  • ask: to declare a field as flag/arg.
    • ask:"<mainthing>": a positional required argument
    • ask:"[extrathing]: a positional optional argument
    • ask:"--my-flag: a long flag
    • ask:"-v: a shorthand flag
    • ask:"--verbose -v": a long flag with shorthand
    • ask:".: inline group
    • ask:".groupnamehere: flag group (can be nested)
  • help:"Infomation about flag here": define flag / flag-group usage info
  • hidden:"any value": to hide a flag from usage info
  • deprecated:"reason here": to mark a flag as deprecated
  • changed:"someflagname: to track if another flag has changed, for boolean struct fields only.

Example:

type BoundCmd struct {
    LowBound uint64 `ask:"--low -l" help:"Lower bound"`
    HighBound uint64 `ask:"--high -h" help:"higher bound"`
    KeyParam string `ask:"<key-param>" help:"Parameter to bound check"`
}
Inline group flags

Use ask:"." to mark the field as an inline group. The field can be regular or embedded. The below is equivalent to the above BoundCmd.

type Bounds struct {
    LowBound uint64 `ask:"--low -l" help:"Lower bound"`
    HighBound uint64 `ask:"--high -h" help:"higher bound"`
}

type BoundCmd struct {
	Bounds `ask:"."`
    KeyParam string `ask:"<key-param>" help:"Parameter to bound check"`
}
Group flags

Grouping flags helps avoid naming collisions, organizes the flags, and enables group-wise documentation. Groups start with . in the ask field declaration:

type ConnOptions struct {
	Port uint16 `ask:"--port"`
	IP   net.IP `ask:"--ip"`
}

type NodeCmd struct {
	Websocket   ConnOptions `ask:".ws" help:"Websocket connection options"`
    Tcp         ConnOptions `ask:".tcp" help:"Websocket connection options"`
}

And then flags look like:

my-node-cmd --ws.port=5000 --ws.ip=1.2.3.4 --tcp.port=8080 --tcp.ip=5.6.7.8

Routing sub-commands

Implement the CommandRoute interface to return a sub-command.

func (c *RoutedCmd) Cmd(route string) (cmd interface{}, err error) {
	switch route {
    case "foo":
    	return nil, &BoundCmd{KeyParam: "foo"}
    case "bar":
        return nil, &BoundCmd{KeyParam: "bar"}
    default:
        return nil, UnrecognizedErr
    }
}

The routing approach is different from any other CLI library, allowing for very dynamic command execution. Commands can pass along any data to sub-commands (with typing, no context/globals necessary). This also enables easy parametrization of commands, commands can even be recursive.

Route listing

Optionally a CommandRoute can also implement the Routes interface to inform Ask of valid inputs (for usage information, not part of validation).

func (c *RoutedCmd) Routes() []string {
	return []string{"foo", "bar"}
}

Running commands

Implement the Command interface to make a command executable:

func (c *BoundCmd) Run(ctx context.Context, args ...string) error {
	val := getExternalValue(ctx, c.KeyParam)
	if val < c.LowBound || val > c.HighBound {
		return fmt.Errorf("val %d (%s) out of bounds %d <> %d", val, c.KeyParam, c.LowBound, c.HighBound)
    }
    return nil
}

The struct flags/args will be fully initialized before Run executes. Any unparsed trailing arguments are passed to args....

Help

  • Commands and flag groups can implement the Help() string interface to output (dynamic) usage information.
  • Flag-groups and flags can specify the help struct-tag to declare static usage information.
func (c *BoundCmd) Help() string {
	return fmt.Sprintf("checks if the %s is within bounds", c.KeyParam)
}

InitDefault

Commands can implement the InitDefault interface to specify non-zero flag defaults.

func (c *BoundCmd) Default() {
	c.LowBound = 20
	c.HighBound = 45
}

flag.Value

The standard Go flag Value interface func String() string, func Set(string) error can be used to define custom flags.

// ENRFlag wraps an ENR (special encoded address string) to make it a reusable flag type
type ENRFlag enr.Record

func (f *ENRFlag) String() string {
	enrStr, err := addrutil.EnrToString((*enr.Record)(f))
	if err != nil {
		return "? (invalid ENR)"
	}
	return enrStr
}

func (f *ENRFlag) Set(v string) error {
	enrAddr, err := addrutil.ParseEnr(v)
	if err != nil {
		return err
	}
	*f = *(*ENRFlag)(enrAddr)
	return nil
}

TypedValue

A custom flag type can be explicit about its type to enhance usage information, and not rely on a help description for repetitive type information.

func (f *ENRFlag) Type() string {
    return "ENR"
}

ImplicitValue

A boolean flag can omit the value to be interpreted as True, e.g. my-cli do something --awesome. For a flag to have an implicit value, implement this interface.

func (b *BoolValue) Implicit() string {
	return "true"
}

Usage

// load a command struct
cmd, err := Load(&MyCommandStruct{})

// Execute a command
subcmd, err := cmd.Execute(context.Background(), nil, "hello", "sub", "some", "args", "--here")

The help information, along usage info (flag set info + default values + sub commands list) can be retrieved from .Usage(showHidden) after Load()-ing the command.

For default options that are not "" or 0 or other Go defaults, the Default() interface can be implemented on a command, to set its flag values during Load().

For convenience ask.Run(&MyCommandStruct{}) can be used to parse args, run and shut-down with os.Interrupt (if io.Closer).

License

MIT, see LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HelpErr = errors.New("ask: help asked with flag")
View Source
var UnrecognizedErr = errors.New("command was not recognized")

Functions

func FlagValue added in v0.1.0

func FlagValue(typ reflect.Type, val reflect.Value) (flag.Value, error)

func ParseArgs added in v0.1.0

func ParseArgs(sortedShort []PrefixedFlag, sortedLong []PrefixedFlag,
	args []string, set ApplyArg) (remaining []string, err error)

ParseArgs parses arguments as flags (long and short format). Not all arguments may be consumed as flags, the remaining arguments are returned. Unrecognized flags result in an error. A HelpErr is returned if a flag like `--help` or `-h` is detected.

func ParseIPv4Mask added in v0.1.0

func ParseIPv4Mask(s string) net.IPMask

ParseIPv4Mask written in IP form (e.g. 255.255.255.0). This function should really belong to the net package.

func ParseLongArg added in v0.1.0

func ParseLongArg(sortedFlags []PrefixedFlag, firstArg string, args []string, fn ApplyArg) (nextArgs []string, err error)

ParseLongArg parses an argument as long-flag. It may consume more arguments: remaining arguments to parse next are returned. A HelpErr is returned when a flag is detected like `--help`.

The sortedFlags slice is ordered from low to high long string.

func ParseShortArg added in v0.1.0

func ParseShortArg(sortedFlags []PrefixedFlag, firstArg string, args []string, fn ApplyArg) (nextArgs []string, err error)

ParseShortArg parses an argument as shorthand(s) string. It may consume more arguments: remaining arguments to parse next are returned. A HelpErr is returned when a flag is detected like `-h`.

The sortedFlags slice is ordered from low to high shorthand string

func Run added in v0.1.3

func Run(cmd interface{})

Run is a convenience-method to run a command: it handles long-running commands and shuts down on os.Interrupt signal. Arguments are read from os.Args[1:] (i.e. program name is skipped). Set the "HIDDEN_OPTIONS" env var to show hidden CLI options.

Types

type ApplyArg added in v0.1.0

type ApplyArg func(fl PrefixedFlag, value string) error

type BoolSliceValue added in v0.1.0

type BoolSliceValue []bool

func (*BoolSliceValue) Set added in v0.1.0

func (s *BoolSliceValue) Set(val string) error

func (*BoolSliceValue) String added in v0.1.0

func (s *BoolSliceValue) String() string

func (*BoolSliceValue) Type added in v0.1.0

func (s *BoolSliceValue) Type() string

type BoolValue added in v0.1.0

type BoolValue bool

func (*BoolValue) Implicit added in v0.1.0

func (b *BoolValue) Implicit() string

func (*BoolValue) Set added in v0.1.0

func (b *BoolValue) Set(s string) error

func (*BoolValue) String added in v0.1.0

func (b *BoolValue) String() string

func (*BoolValue) Type added in v0.1.0

func (b *BoolValue) Type() string

type BytesHexFlag added in v0.0.2

type BytesHexFlag []byte

BytesHex exposes bytes as a flag, hex-encoded, optional whitespace padding, case insensitive, and optional 0x prefix.

func (*BytesHexFlag) Set added in v0.0.2

func (f *BytesHexFlag) Set(value string) error

func (BytesHexFlag) String added in v0.0.2

func (f BytesHexFlag) String() string

func (*BytesHexFlag) Type added in v0.0.2

func (f *BytesHexFlag) Type() string

type ChangedMarkers added in v0.1.0

type ChangedMarkers map[string][]*bool

ChangedMarkers tracks which flags are changed.

type Command

type Command interface {
	// Run the command, with context and remaining unrecognized args
	Run(ctx context.Context, args ...string) error
}

type CommandDescription

type CommandDescription struct {
	FlagGroup
	// Define a field as 'MySettingChanged bool `changed:"my-setting"`' to e.g. track '--my-setting' being changed.
	// The same flag may be tracked with multiple fields
	ChangedMarkers ChangedMarkers
	// Command to run, may be nil if nothing has to run
	Command
	// Sub-command routing, can create commands (or other sub-commands) to access, may be nil if no sub-commands
	CommandRoute
}

An interface{} can be loaded as a command-description to execute it. See Load()

func Load

func Load(val interface{}) (*CommandDescription, error)

Load takes a structure instance that defines a command through its type, and the default values by determining them from the actual type.

func LoadReflect

func LoadReflect(val reflect.Value) (*CommandDescription, error)

LoadReflect is the same as Load, but directly using reflection to handle the value.

func (*CommandDescription) Execute

func (descr *CommandDescription) Execute(ctx context.Context, opts *ExecutionOptions, args ...string) (final *CommandDescription, err error)

Execute runs the command, with given context and arguments. Commands may have routes to sub-commands, the final sub-command that actually runs is returned, and may be nil in case of an error.

A HelpErr is returned when help information was requested for the command (through `help`, `--help` or `-h`) A UnrecognizedErr is returned when a sub-command was expected but not found.

To add inputs/outputs such as STDOUT to a command, add the readers/writers as field in the command struct definition, and the command can pass them on to sub-commands. Similarly logging and other misc. data can be passed around. The execute parameters are kept minimal.

opts.OnDeprecated is called for each deprecated flag, and command execution exits immediately if this callback returns an error.

func (*CommandDescription) Load

func (descr *CommandDescription) Load(val interface{}) error

Load adds more flags/args/meta to the command description. It recursively goes into the field if it's tagged with `ask:"."` (recurse depth-first). Embedded fields are handled as regular fields unless explicitly squashed. It skips the field explicitly if it's tagged with `ask:"-"` Multiple target values can be loaded if they do not conflict, the first Command and CommandRoute found will be used. The flags will be set over all loaded values.

func (*CommandDescription) LoadReflect

func (descr *CommandDescription) LoadReflect(val reflect.Value) error

LoadReflect is the same as Load, but directly using reflection to handle the value.

func (*CommandDescription) Usage

func (descr *CommandDescription) Usage(showHidden bool) string

Usage prints the help information and the usage of all flags.

type CommandKnownRoutes added in v0.0.2

type CommandKnownRoutes interface {
	// Routes lists the sub-commands that can be asked from Get.
	Routes() []string
}

CommandKnownRoutes may be implemented by a CommandRoute to declare which routes are accessible, useful for e.g. help messages to give more information for each of the subcommands.

type CommandRoute

type CommandRoute interface {
	// Cmd gets a sub-command, which can be a Command or CommandRoute
	// The command that is returned will be loaded with `Load` before it runs or its subcommand is retrieved.
	// Return nil if the command route should be ignored, e.g. if this route is also a regular command with arguments.
	Cmd(route string) (cmd interface{}, err error)
}

type DurationSliceValue added in v0.1.0

type DurationSliceValue []time.Duration

func (*DurationSliceValue) Set added in v0.1.0

func (s *DurationSliceValue) Set(val string) error

func (*DurationSliceValue) String added in v0.1.0

func (s *DurationSliceValue) String() string

func (*DurationSliceValue) Type added in v0.1.0

func (s *DurationSliceValue) Type() string

type DurationValue added in v0.1.0

type DurationValue time.Duration

func (*DurationValue) Set added in v0.1.0

func (d *DurationValue) Set(s string) error

func (*DurationValue) String added in v0.1.0

func (d *DurationValue) String() string

func (*DurationValue) Type added in v0.1.0

func (d *DurationValue) Type() string

type ExecutionOptions added in v0.1.0

type ExecutionOptions struct {
	OnDeprecated func(fl PrefixedFlag) error
}

type Flag added in v0.1.0

type Flag struct {
	Value flag.Value
	Name  string
	// 0 if no shorthand
	Shorthand uint8
	IsArg     bool
	Help      string
	Default   string
	Required  bool
	// Reason for deprecation. Empty if not deprecated.
	Deprecated string
	Hidden     bool
}

func LoadField added in v0.1.0

func LoadField(f reflect.StructField, val reflect.Value) (fl *Flag, err error)

LoadField loads a struct field as flag

type FlagGroup added in v0.1.0

type FlagGroup struct {
	GroupName string
	// Optional help info, provided by the struct that covers this group of flags
	Help
	// sub-groups
	Entries []*FlagGroup
	// flags in this group (does not include sub-groups)
	Flags []*Flag
}

func LoadGroup added in v0.1.0

func LoadGroup(name string, val reflect.Value, changes ChangedMarkers) (*FlagGroup, error)

func (*FlagGroup) All added in v0.1.0

func (g *FlagGroup) All(prefix string) []PrefixedFlag

func (*FlagGroup) Usage added in v0.1.0

func (g *FlagGroup) Usage(prefix string, showHidden bool, out *strings.Builder)

type Float32SliceValue added in v0.1.0

type Float32SliceValue []float32

func (*Float32SliceValue) Set added in v0.1.0

func (s *Float32SliceValue) Set(val string) error

func (*Float32SliceValue) String added in v0.1.0

func (s *Float32SliceValue) String() string

func (*Float32SliceValue) Type added in v0.1.0

func (s *Float32SliceValue) Type() string

type Float32Value added in v0.1.0

type Float32Value float32

func (*Float32Value) Set added in v0.1.0

func (f *Float32Value) Set(s string) error

func (*Float32Value) String added in v0.1.0

func (f *Float32Value) String() string

func (*Float32Value) Type added in v0.1.0

func (f *Float32Value) Type() string

type Float64SliceValue added in v0.1.0

type Float64SliceValue []float64

func (*Float64SliceValue) Set added in v0.1.0

func (s *Float64SliceValue) Set(val string) error

func (*Float64SliceValue) String added in v0.1.0

func (s *Float64SliceValue) String() string

func (*Float64SliceValue) Type added in v0.1.0

func (s *Float64SliceValue) Type() string

type Float64Value added in v0.1.0

type Float64Value float64

func (*Float64Value) Set added in v0.1.0

func (f *Float64Value) Set(s string) error

func (*Float64Value) String added in v0.1.0

func (f *Float64Value) String() string

func (*Float64Value) Type added in v0.1.0

func (f *Float64Value) Type() string

type Help

type Help interface {
	// Help explains how a command or group of flags is used.
	Help() string
}

type IPMaskValue added in v0.1.0

type IPMaskValue net.IPMask

func (*IPMaskValue) Set added in v0.1.0

func (i *IPMaskValue) Set(s string) error

func (*IPMaskValue) String added in v0.1.0

func (i *IPMaskValue) String() string

func (*IPMaskValue) Type added in v0.1.0

func (i *IPMaskValue) Type() string

type IPNetValue added in v0.1.0

type IPNetValue net.IPNet

func (*IPNetValue) Set added in v0.1.0

func (ipnet *IPNetValue) Set(s string) error

func (IPNetValue) String added in v0.1.0

func (ipnet IPNetValue) String() string

func (*IPNetValue) Type added in v0.1.0

func (*IPNetValue) Type() string

type IPSliceValue added in v0.1.0

type IPSliceValue []net.IP

func (*IPSliceValue) Set added in v0.1.0

func (s *IPSliceValue) Set(val string) error

func (*IPSliceValue) String added in v0.1.0

func (s *IPSliceValue) String() string

func (*IPSliceValue) Type added in v0.1.0

func (s *IPSliceValue) Type() string

type IPValue added in v0.1.0

type IPValue net.IP

func (*IPValue) Set added in v0.1.0

func (i *IPValue) Set(s string) error

func (*IPValue) String added in v0.1.0

func (i *IPValue) String() string

func (*IPValue) Type added in v0.1.0

func (i *IPValue) Type() string

type ImplicitValue added in v0.1.0

type ImplicitValue interface {
	flag.Value
	// Implicit returns the omitted value of the flag if the flag is used without explicit value
	Implicit() string
}

type InitDefault added in v0.0.2

type InitDefault interface {
	// Default the flags of a command.
	Default()
}

InitDefault can be implemented by a command to not rely on the parent command initializing the command correctly, and instead move the responsibility to the command itself. The default is initialized during Load, and a command may embed multiple sub-structures that implement Default.

type InlineHelp added in v0.1.0

type InlineHelp string

func (InlineHelp) Help added in v0.1.0

func (v InlineHelp) Help() string

type Int16SliceValue added in v0.1.0

type Int16SliceValue []int16

func (*Int16SliceValue) Set added in v0.1.0

func (s *Int16SliceValue) Set(val string) error

func (*Int16SliceValue) String added in v0.1.0

func (s *Int16SliceValue) String() string

func (*Int16SliceValue) Type added in v0.1.0

func (s *Int16SliceValue) Type() string

type Int16Value added in v0.1.0

type Int16Value int16

func (*Int16Value) Set added in v0.1.0

func (i *Int16Value) Set(s string) error

func (*Int16Value) String added in v0.1.0

func (i *Int16Value) String() string

func (*Int16Value) Type added in v0.1.0

func (i *Int16Value) Type() string

type Int32SliceValue added in v0.1.0

type Int32SliceValue []int32

func (*Int32SliceValue) Set added in v0.1.0

func (s *Int32SliceValue) Set(val string) error

func (*Int32SliceValue) String added in v0.1.0

func (s *Int32SliceValue) String() string

func (*Int32SliceValue) Type added in v0.1.0

func (s *Int32SliceValue) Type() string

type Int32Value added in v0.1.0

type Int32Value int32

func (*Int32Value) Set added in v0.1.0

func (i *Int32Value) Set(s string) error

func (*Int32Value) String added in v0.1.0

func (i *Int32Value) String() string

func (*Int32Value) Type added in v0.1.0

func (i *Int32Value) Type() string

type Int64SliceValue added in v0.1.0

type Int64SliceValue []int64

func (*Int64SliceValue) Set added in v0.1.0

func (s *Int64SliceValue) Set(val string) error

func (*Int64SliceValue) String added in v0.1.0

func (s *Int64SliceValue) String() string

func (*Int64SliceValue) Type added in v0.1.0

func (s *Int64SliceValue) Type() string

type Int64Value added in v0.1.0

type Int64Value int64

func (*Int64Value) Set added in v0.1.0

func (i *Int64Value) Set(s string) error

func (*Int64Value) String added in v0.1.0

func (i *Int64Value) String() string

func (*Int64Value) Type added in v0.1.0

func (i *Int64Value) Type() string

type Int8SliceValue added in v0.1.0

type Int8SliceValue []int8

func (*Int8SliceValue) Set added in v0.1.0

func (s *Int8SliceValue) Set(val string) error

func (*Int8SliceValue) String added in v0.1.0

func (s *Int8SliceValue) String() string

func (*Int8SliceValue) Type added in v0.1.0

func (s *Int8SliceValue) Type() string

type Int8Value added in v0.1.0

type Int8Value int8

func (*Int8Value) Set added in v0.1.0

func (i *Int8Value) Set(s string) error

func (*Int8Value) String added in v0.1.0

func (i *Int8Value) String() string

func (*Int8Value) Type added in v0.1.0

func (i *Int8Value) Type() string

type IntSliceValue added in v0.1.0

type IntSliceValue []int

func (*IntSliceValue) Set added in v0.1.0

func (s *IntSliceValue) Set(val string) error

func (*IntSliceValue) String added in v0.1.0

func (s *IntSliceValue) String() string

func (*IntSliceValue) Type added in v0.1.0

func (s *IntSliceValue) Type() string

type IntValue added in v0.1.0

type IntValue int

func (*IntValue) Set added in v0.1.0

func (i *IntValue) Set(s string) error

func (*IntValue) String added in v0.1.0

func (i *IntValue) String() string

func (*IntValue) Type added in v0.1.0

func (i *IntValue) Type() string

type PrefixedFlag added in v0.1.0

type PrefixedFlag struct {
	// Prefix and flag name, segments separated by dot
	Path string
	*Flag
}

type StringSliceValue added in v0.1.0

type StringSliceValue []string

func (*StringSliceValue) Set added in v0.1.0

func (s *StringSliceValue) Set(val string) error

func (*StringSliceValue) String added in v0.1.0

func (s *StringSliceValue) String() string

func (*StringSliceValue) Type added in v0.1.0

func (s *StringSliceValue) Type() string

type StringValue added in v0.1.0

type StringValue string

func (*StringValue) Set added in v0.1.0

func (s *StringValue) Set(val string) error

func (*StringValue) String added in v0.1.0

func (s *StringValue) String() string

func (*StringValue) Type added in v0.1.0

func (s *StringValue) Type() string

type TypedValue added in v0.1.0

type TypedValue interface {
	flag.Value
	Type() string
}

TypedValue is the interface to the dynamic value stored in a flag. (The default value is represented as a string.) Extension of flag.Value with Type information.

type Uint16SliceValue added in v0.1.0

type Uint16SliceValue []uint16

func (*Uint16SliceValue) Set added in v0.1.0

func (s *Uint16SliceValue) Set(val string) error

func (*Uint16SliceValue) String added in v0.1.0

func (s *Uint16SliceValue) String() string

func (*Uint16SliceValue) Type added in v0.1.0

func (s *Uint16SliceValue) Type() string

type Uint16Value added in v0.1.0

type Uint16Value uint16

func (*Uint16Value) Set added in v0.1.0

func (i *Uint16Value) Set(s string) error

func (*Uint16Value) String added in v0.1.0

func (i *Uint16Value) String() string

func (*Uint16Value) Type added in v0.1.0

func (i *Uint16Value) Type() string

type Uint32SliceValue added in v0.1.0

type Uint32SliceValue []uint32

func (*Uint32SliceValue) Set added in v0.1.0

func (s *Uint32SliceValue) Set(val string) error

func (*Uint32SliceValue) String added in v0.1.0

func (s *Uint32SliceValue) String() string

func (*Uint32SliceValue) Type added in v0.1.0

func (s *Uint32SliceValue) Type() string

type Uint32Value added in v0.1.0

type Uint32Value uint32

func (*Uint32Value) Set added in v0.1.0

func (i *Uint32Value) Set(s string) error

func (*Uint32Value) String added in v0.1.0

func (i *Uint32Value) String() string

func (*Uint32Value) Type added in v0.1.0

func (i *Uint32Value) Type() string

type Uint64SliceValue added in v0.1.0

type Uint64SliceValue []uint64

func (*Uint64SliceValue) Set added in v0.1.0

func (s *Uint64SliceValue) Set(val string) error

func (*Uint64SliceValue) String added in v0.1.0

func (s *Uint64SliceValue) String() string

func (*Uint64SliceValue) Type added in v0.1.0

func (s *Uint64SliceValue) Type() string

type Uint64Value added in v0.1.0

type Uint64Value uint64

func (*Uint64Value) Set added in v0.1.0

func (i *Uint64Value) Set(s string) error

func (*Uint64Value) String added in v0.1.0

func (i *Uint64Value) String() string

func (*Uint64Value) Type added in v0.1.0

func (i *Uint64Value) Type() string

type Uint8Value added in v0.1.0

type Uint8Value uint8

func (*Uint8Value) Set added in v0.1.0

func (i *Uint8Value) Set(s string) error

func (*Uint8Value) String added in v0.1.0

func (i *Uint8Value) String() string

func (*Uint8Value) Type added in v0.1.0

func (i *Uint8Value) Type() string

type UintSliceValue added in v0.1.0

type UintSliceValue []uint

func (*UintSliceValue) Set added in v0.1.0

func (s *UintSliceValue) Set(val string) error

func (*UintSliceValue) String added in v0.1.0

func (s *UintSliceValue) String() string

func (*UintSliceValue) Type added in v0.1.0

func (s *UintSliceValue) Type() string

type UintValue added in v0.1.0

type UintValue uint

func (*UintValue) Set added in v0.1.0

func (i *UintValue) Set(s string) error

func (*UintValue) String added in v0.1.0

func (i *UintValue) String() string

func (*UintValue) Type added in v0.1.0

func (i *UintValue) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL