parse

package
v0.0.0-...-a013e18 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParseResult

type ParseResult struct {
	Flags       map[string]string
	Positionals []string
}

A datastructure representing the result from parsing input.

func Parse

func Parse() *ParseResult

Parse from os.Args

func ParseFromSlice

func ParseFromSlice(input []string) *ParseResult

Parse args from string slice `input` If you're unsure about the correctness of your input, see parse.toFilteredSlice(string) for more information.

func ParseFromString

func ParseFromString(input string) *ParseResult

Parse arguments from a string. The input string is preprocessed with respect to strings within the input string. see parse.toFilteredSlice(string) for more information.

func (*ParseResult) GetBoolFlag

func (slf *ParseResult) GetBoolFlag(key string) (*bool, error)

Get a bool from the parsed flags by some key `key`

func (*ParseResult) GetFloatFlag

func (slf *ParseResult) GetFloatFlag(key string) (*float64, error)

Get a float from the parsed flags by some key `key`

func (*ParseResult) GetFloatIndex

func (slf *ParseResult) GetFloatIndex(idx int) (*float64, error)

Get a float from the parsed positional arguments according to some index `idx`

func (*ParseResult) GetIntFlag

func (slf *ParseResult) GetIntFlag(key string) (*int, error)

Get an int from the parsed flags by some key `key`

func (*ParseResult) GetIntIndex

func (slf *ParseResult) GetIntIndex(idx int) (*int, error)

Get an int from the parsed positional arguments according to some index `idx`

func (*ParseResult) GetStringFlag

func (slf *ParseResult) GetStringFlag(key string) (*string, error)

Get a string from the parsed flags by some key `key`

func (*ParseResult) GetStringIndex

func (slf *ParseResult) GetStringIndex(idx int) (*string, error)

Get a string from the parsed positional arguments according to some index `idx`

Jump to

Keyboard shortcuts

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