validated

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commands

type Commands struct {
	ValidatedArgs  `command:"valid-positionals" desc:"Positional arguments validated with struct tag directives"`
	ValidatedFlags `command:"valid-flags" desc:"Flags validated with struct tag directives"`
}

Commands is a struct acting as a group of commands. All of these make use of tag directives to provide validation to their positional args or flags.

type ValidatedArgs

type ValidatedArgs struct {
	Args struct {
		IP     string   `description:"An IPv4 address" validate:"ipv4"`
		Emails []string `description:"A list of email addresses" required:"1-2" validate:"email"`
	} `positional-args:"yes"`
}

ValidatedArgs is a command whose positionals are being validated.

func (*ValidatedArgs) Execute

func (c *ValidatedArgs) Execute(args []string) error

type ValidatedFlags

type ValidatedFlags struct {
	Path         string            `short:"p" long:"path" description:"A valid path on your system" complete:"Files" validate:"file"`
	OptionalPath string            `` /* 157-byte string literal not displayed */
	Files        []string          `short:"f" long:"files" desc:"A list of files, each validated" complete:"Files" validate:"file"`
	Elems        map[string]string `` /* 163-byte string literal not displayed */
}

ValidatedArgs is a command whose flags' arguments are being validated.

func (*ValidatedFlags) Execute

func (c *ValidatedFlags) Execute(args []string) error

Jump to

Keyboard shortcuts

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