Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppProperties ¶
type AppProperties struct { PackageName string EnvConfigName string FileConfigName string ReqEnvName string PermConfigFile os.FileMode PermConfigDir os.FileMode }
AppProperties represents constants associated with the running application.
func (*AppProperties) ConfigPath ¶
func (app *AppProperties) ConfigPath() string
ConfigPath provides the default YAML configuration file path when not overridden by the user via command-line Parameters.
func (*AppProperties) HomeDir ¶
func (app *AppProperties) HomeDir() string
HomeDir provides an absolute path to the user's home directory. Note that if no $HOME dir can be determined, the current working dir is returned.
type ArgExpansion ¶
type ArgExpansion struct {
// contains filtered or unexported fields
}
ArgExpansion defines the simple single-pass expansion rules performed on the args elements defined in the YAML configuration file.
func NewArgExpansion ¶
func NewArgExpansion(initFile string, shellArgs ...string) *ArgExpansion
NewArgExpansion constructs a new expansion ruleset with given expansion values and compiles the internal key matcher.
func (*ArgExpansion) Compile ¶
func (ae *ArgExpansion) Compile() *regexp.Regexp
Compile builds a regexp pattern that matches a key in the ruleset by simply using a group-logical-OR of each key escaped via regexp.QuoteMeta.
func (*ArgExpansion) Expand ¶
func (ae *ArgExpansion) Expand(arg string) interface{}
Expand performs a single-pass literal string substitution according to the rule map. If the given arg matches exactly a rule key, then the rule value is returned, otherwise the original arg is returned.
func (*ArgExpansion) ExpandArgs ¶
func (ae *ArgExpansion) ExpandArgs(args ...string) []string
ExpandArgs calls Expand on each element in args.
type ArgList ¶
type ArgList []string
ArgList contains the positional arguments given to the shell command. Do NOT include the command at position 0 (as required); it will be added for you.
type Config ¶
type Config struct { Shell string `yaml:"shell"` Args ArgList `yaml:"args"` CmdFlag string `yaml:"cmdflag"` Env EnvList `yaml:"env"` }
Config represents the parameters to launch and configure the user shell.
type Parameters ¶
type Parameters struct { App AppProperties ConfigPath string ShellCommand string LogHandler string DebugEnabled bool OrphanEnviron bool Profiles Profile ShellArgs []string }
Parameters represents the global configuration of the application, mostly defined or initialized by command-line arguments.
type Profile ¶
type Profile []string
Profile represents gosh environments to load.
type ProfileFlag ¶
ProfileFlag contains the attributes of a Profile type command-line flag.
type Source ¶
type Source map[string]SourceList
Source associates a named directory/environment with a SourceList.
type SourceList ¶
type SourceList []string
SourceList contains names of files to be sourced by the shell environment.
type StartFlags ¶
type StartFlags struct { ConfigPath StringFlag ShellCommand StringFlag Profiles ProfileFlag OrphanEnviron BoolFlag LogHandler StringFlag DebugEnabled BoolFlag }
StartFlags contains attributes of the pre-defined command-line flags.
func (*StartFlags) Parse ¶
func (sf *StartFlags) Parse(app *AppProperties) *Parameters
Parse initializes the default flagset and parses command-line flags into the shareable Parameters struct.
type StringFlag ¶
StringFlag contains the attributes of a string type command-line flag.