phraserouters

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Deprecated: Package phraserouters was a command-line flag parsing attempt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalisePhrase

func NormalisePhrase(phrase string) string

func ParseNonEmptyString deprecated

func ParseNonEmptyString(raw string) (*string, error)

Deprecated: TODO

func PopParsed deprecated

func PopParsed[T any](cli *CLI, parse func(string) (*T, error)) *T

Deprecated: ugly design

Types

type CLI

type CLI struct {
	Phrase string

	Args []string
	// Flags MUST NOT be nil.
	Flags map[Flag]string
}

func (*CLI) Done

func (cli *CLI) Done() bool

func (*CLI) FlagBool

func (cli *CLI) FlagBool(flagwithdashes string) bool

func (*CLI) NoMore

func (cli *CLI) NoMore()

func (*CLI) NoMoreArgs

func (cli *CLI) NoMoreArgs()

func (*CLI) NoMoreFlags

func (cli *CLI) NoMoreFlags()

func (*CLI) Pop

func (cli *CLI) Pop(outof ...string) string

func (*CLI) PopLeft

func (cli *CLI) PopLeft() []string

type Entry

type Entry struct {
	Phrase string

	// Gobblers may be nil
	Gobblers map[Flag]bool

	Description string

	EntryPoint
}

type EntryPoint

type EntryPoint = func(*CLI)

type Flag

type Flag = string

type Router

type Router struct {
	Arg0 string

	Entries []Entry

	Errs []error
}

func (*Router) Failf

func (router *Router) Failf(format string, a ...any)

func (*Router) Main

func (router *Router) Main()

func (*Router) Route

func (router *Router) Route(phrase string, gobblers map[Flag]bool, description string, entrypoint EntryPoint)

Jump to

Keyboard shortcuts

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