diff --git a/cex.go b/cex.go index 49351dc..b59001d 100644 --- a/cex.go +++ b/cex.go @@ -12,7 +12,8 @@ // Example usage: // // postcode := "S10 1LT" // royal armouries museum, leeds -// kit := cex.NewCex()cex.Search(queries, strict, postcode) +// kit := cex.NewCex() +// cex.Search(queries, strict, postcode) // results, err := kit.Search(queries, strict) // if err != nil { // log.Fatal(err) @@ -110,7 +111,7 @@ func (b *Box) StoresString(length int) string { return storeString } - storeString += fmt.Sprintf("%s", b.Stores[0]) + storeString += b.Stores[0].String() for _, s := range b.Stores[1:] { storeString += fmt.Sprintf(", %s", s) } diff --git a/cmd/console/input.go b/cmd/console/input.go index 7dfd3bd..534b9dc 100644 --- a/cmd/console/input.go +++ b/cmd/console/input.go @@ -76,7 +76,7 @@ func newInModel() inModel { p.Cursor.Style = postcodeNormalStyle p.CharLimit = 8 p.Placeholder = "postcode" - p.PromptStyle = postcodeNormalStyle + p.PromptStyle = postcodeFocusedStyle p.Width = 12 return inModel{ @@ -152,9 +152,12 @@ func (in inModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } } + cmds := []tea.Cmd{} in.input, cmd = in.input.Update(msg) + cmds = append(cmds, cmd) in.postcode, cmd = in.postcode.Update(msg) - return in, cmd + cmds = append(cmds, cmd) + return in, tea.Batch(cmds...) } // enter event message diff --git a/cmd/web/server.go b/cmd/web/server.go index 2fbc067..021be89 100644 --- a/cmd/web/server.go +++ b/cmd/web/server.go @@ -40,12 +40,11 @@ type server struct { // searcher is an indirect of cex.Search to allow testing searcher func(cex *cexfind.CexFind, queries []string, strict bool, postcode string) ([]cex.Box, error) - inDevelopment bool - staticDirDev string - tplDirDev string - staticDir string - tplDir string - DirFS *fileSystem + staticDirDev string + tplDirDev string + staticDir string + tplDir string + DirFS *fileSystem // serveFunc is an indirect for the main server functionality, // provided for testing