commands

package
v1.8.67 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const HelpCommandName = "help"

Variables

View Source
var (
	ErrNoCommandSpecified = errors.New("No command specified")
	ErrInvalidCommand     = errors.New("Invalid command")
)

Functions

func PrintHelp

func PrintHelp(log *zap.Logger, config *lib.Config, args []string) error

Types

type Cmd

type Cmd struct {
	Options lib.Options

	Config *lib.Config
	// contains filtered or unexported fields
}

Cmd is a container for handling commands

func (*Cmd) Run

func (c *Cmd) Run(args []string) error

Run is the main function that handles commands arguments and routes them to their correct options and functions

type Command

type Command func(log *zap.Logger, config *lib.Config, args []string) (e error)

Command is a type that represents the possible commands passed in at run time

type Help

type Help func()

type SearchType

type SearchType int

SearchType is the type of search

const (
	// SearchTypeWildcard is a wildcard
	SearchTypeWildcard SearchType = iota
	// SearchTypeStartingWildcard is a wildcard at the start (e.g. `*foo`)
	SearchTypeStartingWildcard
	// SearchTypeEndingWildcard is a wildcard at the end (e.g. `foo*`)
	SearchTypeEndingWildcard
	// SearchTypeBoth is a wildcard on both the start and the end (e.g. `*foo*`)
	SearchTypeBoth
)

Jump to

Keyboard shortcuts

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