cli

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cli handles shell completions

Package cli handles environment variables

Package cli handles CLI flag parsing

Package cli handles help output

Package cli handles context for all operations

Index

Constants

View Source
const (
	// ListCommand will list the active applications
	ListCommand CommandType = "list"
	// PurgeCommand is used to delete old artifacts/dirs/etc.
	PurgeCommand CommandType = "purge"
	// UpgradeCommand is used to update packages
	UpgradeCommand CommandType = "upgrade"
	// VersionCommand displays version information
	VersionCommand = "version"
	// CompletionsCommand generates completions
	CompletionsCommand = "completions"
	// CommitFlag confirms and therefore commits changes
	CommitFlag = "commit"
	// VerbosityFlag changes logging output
	VerbosityFlag = "verbosity"
	// ApplicationsFlag enables selected applications
	ApplicationsFlag = "filter-applications"
	// CleanDirFlag indicates directory cleanup should occur
	CleanDirFlag = "directories"
	// ReDeployFlag will indicate all apps should ignore the redeployment rules and force redeploy
	ReDeployFlag = "force-redeploy"
	// NegateFilter means to IGNORE filter applications
	NegateFilter = "negate-filter"
)
View Source
const (
	// ConfigFileEnv is the environment variable for config file override
	ConfigFileEnv = "BLAP_CONFIG_FILE"
)
View Source
const InfoVerbosity = 2

InfoVerbosity is the default info level for outputs

Variables

This section is empty.

Functions

func DefaultConfigs

func DefaultConfigs() []string

DefaultConfigs is the list of options for config files

func GenerateCompletions

func GenerateCompletions(w io.Writer) error

GenerateCompletions will generate shell completions

func Usage

func Usage(w io.Writer) error

Usage writes usage/help info

Types

type CommandType added in v0.9.0

type CommandType string

CommandType are top-level commands

type Completion

type Completion struct {
	Executable string
	Command    struct {
		Purge   string
		Upgrade string
		List    string
	}
	Params struct {
		Upgrade string
		Purge   string
		List    string
	}
	Arg struct {
		Applications string
		ForceDeploy  string
		Negate       string
		Confirm      string
		CleanDirs    string
	}
}

Completion is the shell completion template object

type Settings

type Settings struct {
	DryRun bool
	Purge  bool
	Writer io.Writer

	Verbosity int
	CleanDirs bool
	ReDeploy  bool
	// contains filtered or unexported fields
}

Settings are the core settings

func Parse

func Parse(w io.Writer, t CommandType, args []string) (*Settings, error)

Parse will parse arguments to settings

func (Settings) AllowApplication

func (s Settings) AllowApplication(input string) bool

AllowApplication indicates if an application is allowed

func (*Settings) CompileApplicationFilter

func (s *Settings) CompileApplicationFilter(filter string, negate bool) error

CompileApplicationFilter will compile the necessary app filter

func (Settings) FilterApplications

func (s Settings) FilterApplications() bool

FilterApplications indicates if the

func (Settings) LogCore

func (s Settings) LogCore(cat logging.Category, msg string, a ...any)

LogCore logs a core message

func (Settings) LogDebug

func (s Settings) LogDebug(cat logging.Category, msg string, a ...any)

LogDebug handles debug logging

func (Settings) ParseToken added in v0.1.7

func (s Settings) ParseToken(t core.Token) (string, error)

ParseToken will handle determine the appropriate token to use

Jump to

Keyboard shortcuts

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