diff --git a/modules/cli/README.md b/modules/cli/README.md index d0ef1e8..b075811 100644 --- a/modules/cli/README.md +++ b/modules/cli/README.md @@ -189,7 +189,7 @@ configs and binaries for running the Astria stack. ## Configuration -The CLI uses four configuration files: +The CLI uses the following configuration files: 1. `tui-config.toml`: Controls app start state of the devrunner TUI 2. `base-config.toml`: Sets service environment variables @@ -201,8 +201,9 @@ The CLI uses four configuration files: Once `astria-go dev init` has been run, edit `~/.astria/tui-config.toml` to control the starting settings of the TUI app. -The `highlight_color` and `border_color` accept both named colors and -hexadecimal notation: +The `highlight_color` and `border_color` accept both [W3C named +colors](https://www.w3schools.com/tags/ref_colornames.asp) and hexadecimal +notation: ```toml highlight_color = "blue" diff --git a/modules/cli/cmd/devrunner/config/tui.go b/modules/cli/cmd/devrunner/config/tui.go index 7cf2e8c..e765377 100644 --- a/modules/cli/cmd/devrunner/config/tui.go +++ b/modules/cli/cmd/devrunner/config/tui.go @@ -69,9 +69,9 @@ func (c TUIConfig) String() string { return output } -// LoadTUIConfigsOrPanic loads the TUIConfigs from the given path. If the file +// LoadTUIConfigOrPanic loads the TUIConfigs from the given path. If the file // cannot be loaded or parsed, the function will panic. -func LoadTUIConfigsOrPanic(path string) TUIConfig { +func LoadTUIConfigOrPanic(path string) TUIConfig { viper.SetConfigFile(path) if err := viper.ReadInConfig(); err != nil { @@ -88,7 +88,7 @@ func LoadTUIConfigsOrPanic(path string) TUIConfig { return config } -// CreateNetworksConfig creates a TUI configuration file and populates it +// CreateTUIConfig creates a TUI configuration file and populates it // with the defaults for the devrunner TUI. It will panic if the file // cannot be created or written to. func CreateTUIConfig(configPath string) { diff --git a/modules/cli/cmd/devrunner/run.go b/modules/cli/cmd/devrunner/run.go index b97ddd2..780ba28 100644 --- a/modules/cli/cmd/devrunner/run.go +++ b/modules/cli/cmd/devrunner/run.go @@ -48,7 +48,7 @@ func runCmdHandler(c *cobra.Command, _ []string) { astriaDir := filepath.Join(homeDir, ".astria") tuiConfigPath := filepath.Join(astriaDir, config.DefaultTUIConfigName) - tuiConfig := config.LoadTUIConfigsOrPanic(tuiConfigPath) + tuiConfig := config.LoadTUIConfigOrPanic(tuiConfigPath) instance := flagHandler.GetValue("instance") config.IsInstanceNameValidOrPanic(instance) @@ -227,7 +227,7 @@ func runCmdHandler(c *cobra.Command, _ []string) { app := ui.NewApp(runners) // start the app with initial setting from the tui config, the border will // always start on - appStartState := ui.BuildStateStore(tuiConfig.AutoScroll, tuiConfig.WrapLines, tuiConfig.Borderless) + appStartState := ui.NewStateStore(tuiConfig.AutoScroll, tuiConfig.WrapLines, tuiConfig.Borderless) app.Start(appStartState) } diff --git a/modules/cli/internal/ui/app.go b/modules/cli/internal/ui/app.go index 39663df..e51adcf 100644 --- a/modules/cli/internal/ui/app.go +++ b/modules/cli/internal/ui/app.go @@ -46,9 +46,9 @@ func NewApp(processrunners []processrunner.ProcessRunner) *App { // Start starts the tview application. func (a *App) Start(stateStore *StateStore) { - // if a state store wans't passed in, create a default one + // if a state store wasn't passed in, create a default one if stateStore == nil { - stateStore = NewStateStore() + stateStore = DefaultStateStore() } // create the views diff --git a/modules/cli/internal/ui/statestore.go b/modules/cli/internal/ui/statestore.go index 23defce..5585781 100644 --- a/modules/cli/internal/ui/statestore.go +++ b/modules/cli/internal/ui/statestore.go @@ -15,8 +15,8 @@ type StateStore struct { mutex sync.Mutex } -// NewStateStore creates a new default StateStore -func NewStateStore() *StateStore { +// DefaultStateStore creates a new default StateStore +func DefaultStateStore() *StateStore { return &StateStore{ state: AppState{ isAutoScroll: true, @@ -26,8 +26,8 @@ func NewStateStore() *StateStore { } } -// BuildStateStore creates a new StateStore with the given parameters -func BuildStateStore(isAutoScroll, isWordWrap, isBorderless bool) *StateStore { +// NewStateStore creates a new StateStore with the given parameters +func NewStateStore(isAutoScroll, isWordWrap, isBorderless bool) *StateStore { return &StateStore{ state: AppState{ isAutoScroll: isAutoScroll,