Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sambukowski committed Aug 21, 2024
1 parent 9122f87 commit acbb083
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
7 changes: 4 additions & 3 deletions modules/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions modules/cli/cmd/devrunner/config/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions modules/cli/cmd/devrunner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions modules/cli/internal/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions modules/cli/internal/ui/statestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit acbb083

Please sign in to comment.