gum

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const JarExt = ".jar"

JarExt the .jar file extension

View Source
const JavaExt = ".java"

JavaExt the .java file extension

View Source
const JshExt = ".jsh"

JshExt the .jsh file extension

Variables

View Source
var NoneTheme *noneTheme = &noneTheme{}

NoneTheme non colored theme

Functions

func FindTool added in v0.8.0

func FindTool(args *ParsedArgs)

FindTool Executes gradle/maven/ant/bach/jbang based on config discovery

Types

type AntCommand added in v0.10.0

type AntCommand struct {
	// contains filtered or unexported fields
}

AntCommand defines an executable Ant command

func FindAnt added in v0.10.0

func FindAnt(context Context, args *ParsedArgs) *AntCommand

FindAnt finds and executes Ant

func (AntCommand) Execute added in v0.10.0

func (c AntCommand) Execute()

Execute executes the given command

type BachCommand added in v0.9.0

type BachCommand struct {
	// contains filtered or unexported fields
}

BachCommand defines an executable Bach command

func FindBach added in v0.9.0

func FindBach(context Context, args *ParsedArgs) *BachCommand

FindBach finds and executes Bach

func (BachCommand) Execute added in v0.9.0

func (c BachCommand) Execute()

Execute executes the given command

type ColoredTheme added in v0.8.0

type ColoredTheme struct {
	// contains filtered or unexported fields
}

ColoredTheme provides a color theme

var DarkTheme *ColoredTheme = &ColoredTheme{
	name:    "dark",
	symbol:  color.S256(255, 0),
	section: color.S256(28, 0),
	key:     color.S256(160, 0),
	boolean: color.S256(99, 0),
	literal: color.S256(33, 0)}

DarkTheme dark colored theme

var LightTheme *ColoredTheme = &ColoredTheme{
	name:    "light",
	symbol:  color.S256(0, 255),
	section: color.S256(28, 255),
	key:     color.S256(160, 255),
	boolean: color.S256(99, 255),
	literal: color.S256(33, 255)}

LightTheme light colored theme

func (*ColoredTheme) PrintKeyValueArrayI added in v0.8.0

func (t *ColoredTheme) PrintKeyValueArrayI(key string, value [2]uint8)

PrintKeyValueArrayI prints a key/value pair as key = [i1, i2]

func (*ColoredTheme) PrintKeyValueArrayS added in v0.8.0

func (t *ColoredTheme) PrintKeyValueArrayS(key string, value []string)

PrintKeyValueArrayS prints a key/value pair as key = ["v1", "v2"]

func (*ColoredTheme) PrintKeyValueBoolean added in v0.8.0

func (t *ColoredTheme) PrintKeyValueBoolean(key string, value bool)

PrintKeyValueBoolean prints a key/value pair as key = value

func (*ColoredTheme) PrintKeyValueLiteral added in v0.8.0

func (t *ColoredTheme) PrintKeyValueLiteral(key string, value string)

PrintKeyValueLiteral prints a key/value pair as key = "value"

func (*ColoredTheme) PrintMap added in v0.8.0

func (t *ColoredTheme) PrintMap(value map[string]string)

PrintMap prints a map with each entry as key = "value"

func (*ColoredTheme) PrintSection added in v0.8.0

func (t *ColoredTheme) PrintSection(section string)

PrintSection prints a section header such as [section]

type Command

type Command interface {
	// Execute executes the given command
	Execute()
}

Command defines an executable command (gradle/maven)

type Config added in v0.4.0

type Config struct {
	// contains filtered or unexported fields
}

Config defines configuration settings for Gum

func ReadConfig added in v0.4.0

func ReadConfig(context Context, rootdir string) *Config

ReadConfig reads and merges project & user config

func ReadConfigFile added in v0.4.0

func ReadConfigFile(context Context, path string) *Config

ReadConfigFile reads the given TOML config file

func ReadUserConfig added in v0.8.0

func ReadUserConfig(context Context) *Config

ReadUserConfig reads user config

type Context added in v0.3.0

type Context interface {
	// IsExplicit whether a given tool was specified
	IsExplicit() bool

	// IsWindows checks if the current OS is Windows
	IsWindows() bool

	// CheckIsExecutable checks if the given file has executable bits
	CheckIsExecutable(file string)

	// GetWorkingDir returns the current working dir
	GetWorkingDir() string

	// GetHomeDir gets the home directory from environment
	GetHomeDir() string

	// GetPaths gets the paths in $PATH
	GetPaths() []string

	// FileExists checks if a file exists
	FileExists(name string) bool

	// Exit causes the current program to exit with the given status code.
	Exit(code int)
}

Context provides an abstraction over the OS and Environment as required by Gum

type DefaultContext added in v0.3.0

type DefaultContext struct {
	// contains filtered or unexported fields
}

DefaultContext is the Context used by default

func NewDefaultContext added in v0.3.0

func NewDefaultContext(explicit bool) DefaultContext

NewDefaultContext creates a new DefaultContext with the given state

func (DefaultContext) CheckIsExecutable added in v0.11.0

func (c DefaultContext) CheckIsExecutable(file string)

CheckIsExecutable checks if the given file has executable bits

func (DefaultContext) Exit added in v0.3.0

func (c DefaultContext) Exit(code int)

Exit causes the current program to exit with the given status code.

func (DefaultContext) FileExists added in v0.3.0

func (c DefaultContext) FileExists(name string) bool

FileExists checks if a file exists

func (DefaultContext) GetHomeDir added in v0.4.0

func (c DefaultContext) GetHomeDir() string

GetHomeDir gets the home directory from environment

func (DefaultContext) GetPaths added in v0.3.0

func (c DefaultContext) GetPaths() []string

GetPaths gets the paths in $PATH

func (DefaultContext) GetWorkingDir added in v0.3.0

func (c DefaultContext) GetWorkingDir() string

GetWorkingDir returns the current working dir

func (DefaultContext) IsExplicit added in v0.3.0

func (c DefaultContext) IsExplicit() bool

IsExplicit whether a given tool was specified

func (DefaultContext) IsWindows added in v0.3.0

func (c DefaultContext) IsWindows() bool

IsWindows checks if the current OS is Windows

type GradleCommand

type GradleCommand struct {
	// contains filtered or unexported fields
}

GradleCommand defines an executable Gradle command

func FindGradle

func FindGradle(context Context, args *ParsedArgs) *GradleCommand

FindGradle finds and executes gradlew/gradle

func (GradleCommand) Execute

func (c GradleCommand) Execute()

Execute executes the given command

type JbangCommand added in v0.6.0

type JbangCommand struct {
	// contains filtered or unexported fields
}

JbangCommand defines an executable Jbang command

func FindJbang added in v0.6.0

func FindJbang(context Context, args *ParsedArgs) *JbangCommand

FindJbang finds and executes jbang

func (JbangCommand) Execute added in v0.6.0

func (c JbangCommand) Execute()

Execute executes the given command

type MavenCommand

type MavenCommand struct {
	// contains filtered or unexported fields
}

MavenCommand defines an executable Maven command

func FindMaven

func FindMaven(context Context, args *ParsedArgs) *MavenCommand

FindMaven finds and executes mvnw/mvn

func (MavenCommand) Execute

func (c MavenCommand) Execute()

Execute executes the given command

type ParsedArgs added in v0.7.0

type ParsedArgs struct {
	Gum  map[string]struct{}
	Tool []string
	Args []string
}

ParsedArgs captures input args separated by responsibility

func ParseArgs added in v0.7.0

func ParseArgs(args []string) ParsedArgs

ParseArgs parses input args and separates them between Gum, Tool, and Args

func (*ParsedArgs) HasGumFlag added in v0.7.0

func (a *ParsedArgs) HasGumFlag(flag string) bool

HasGumFlag finds if a given Gum flag is specified in the parsed args

type Theme added in v0.8.0

type Theme interface {
	// PrintSection prints a section header such as [section]
	PrintSection(section string)

	// PrintKeyValueBoolean prints a key/value pair as key = value
	PrintKeyValueBoolean(key string, value bool)

	// PrintKeyValueLiteral prints a key/value pair as key = "value"
	PrintKeyValueLiteral(key string, value string)

	// PrintKeyValueArrayS prints a key/value pair as key = ["v1", "v2"]
	PrintKeyValueArrayS(key string, value []string)

	// PrintKeyValueArrayI prints a key/value pair as key = [i1, i2]
	PrintKeyValueArrayI(key string, value [2]uint8)

	// PrintMap prints a map with each entry as key = "value"
	PrintMap(value map[string]string)
}

Theme defines a console theme for printing messages

Jump to

Keyboard shortcuts

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