Documentation ¶
Index ¶
- Constants
- Variables
- func FindTool(args *ParsedArgs)
- type AntCommand
- type BachCommand
- type ColoredTheme
- func (t *ColoredTheme) PrintKeyValueArrayI(key string, value [2]uint8)
- func (t *ColoredTheme) PrintKeyValueArrayS(key string, value []string)
- func (t *ColoredTheme) PrintKeyValueBoolean(key string, value bool)
- func (t *ColoredTheme) PrintKeyValueLiteral(key string, value string)
- func (t *ColoredTheme) PrintMap(value map[string]string)
- func (t *ColoredTheme) PrintSection(section string)
- type Command
- type Config
- type Context
- type DefaultContext
- func (c DefaultContext) CheckIsExecutable(file string)
- func (c DefaultContext) Exit(code int)
- func (c DefaultContext) FileExists(name string) bool
- func (c DefaultContext) GetHomeDir() string
- func (c DefaultContext) GetPaths() []string
- func (c DefaultContext) GetWorkingDir() string
- func (c DefaultContext) IsExplicit() bool
- func (c DefaultContext) IsWindows() bool
- type GradleCommand
- type JbangCommand
- type MavenCommand
- type ParsedArgs
- type Theme
Constants ¶
const JarExt = ".jar"
JarExt the .jar file extension
const JavaExt = ".java"
JavaExt the .java file extension
const JshExt = ".jsh"
JshExt the .jsh file extension
Variables ¶
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
ReadConfig reads and merges project & user config
func ReadConfigFile ¶ added in v0.4.0
ReadConfigFile reads the given TOML config file
func ReadUserConfig ¶ added in v0.8.0
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
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
type ParsedArgs ¶ added in v0.7.0
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