args

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	Arguments []Argument `(@@|`
	// contains filtered or unexported fields
}

Args is both used as the grammar and the tree representation of the abstract syntactic structure of the command-line arguments.

func Parse

func Parse() Args

Parse returns the AST of the command-line arguments, starting after the program name.

func (*Args) Bind

func (a *Args) Bind(c command)

Bind binds the fields of the given struct with matching argument values.

type Argument

type Argument struct {
	Identifier string `@('-'|Let|Num)+`
	Value      Value  `@@?`
}

type InvalidArgumentError

type InvalidArgumentError struct {
	Argument string
}

func (*InvalidArgumentError) Error

func (i *InvalidArgumentError) Error() string

type Value

type Value struct {
	Assignment string `@'='`
	String     string `@(Let|Num|Pun|Sym|Sep)+`
}

Jump to

Keyboard shortcuts

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