Documentation ¶
Overview ¶
Package cli is the application entry point.
Index ¶
Constants ¶
const AppName = "tmpl"
AppName is the name of the CLI application.
Variables ¶
var ( ErrHelp = errors.New("help requested") ErrVersion = errors.New("version requested") )
var ErrInvalidConfig = fmt.Errorf("invalid configuration")
ErrInvalidConfig is returned when a configuration is invalid.
Functions ¶
func BuildCommit ¶
func BuildCommit() string
BuildCommit returns the git commit hash tmpl was built from.
Returns `HEAD` if no build commit is set.
func BuildGoVersion ¶
func BuildGoVersion() string
BuildGoVersion returns the go version tmpl was built with.
Returns version from runtime.Version if not set.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main command-line application.
The application orchestrates the loading of options and configuration, and applying the configuration to a new tmux session.
The application can be configured with options to facilitate testing, such as providing a writer for output instead of os.Stdout, or providing a pre-loaded configuration instead of loading it from a configuration file.
type AppOption ¶
AppOptions configures an App.
func WithConfig ¶
WithConfig configures the App to use provided configuration instead of loading it from a configuration file.
This option is intended for testing purposes only.
func WithOptions ¶
func WithOptions(opts *options) AppOption
WithOptions configures the App to use provided options instead of parsing command-line flags.
This option is intended for testing purposes only.
func WithOutputWriter ¶
WithOutputWriter configures the App to use provided writer for output instead of os.Stdout.
This option is intended for testing purposes only.
func WithSlogAttrReplacer ¶
WithSlogAttrReplacer configures the App to use provided function for replacing slog attributes.
This option is intended for testing purposes only.