refactor: rename gum search to gum filter

This commit is contained in:
Maas Lalani 2022-07-08 13:58:14 -04:00
parent 432d6dd032
commit 901e367fe2
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
7 changed files with 15 additions and 15 deletions

View file

@ -74,7 +74,7 @@ Prompt your users to write some multi-line text.
gum write > story.text
```
#### Search
#### Filter
Allow your users to filter through a list of options by fuzzy searching.
@ -82,7 +82,7 @@ Allow your users to filter through a list of options by fuzzy searching.
echo Strawberry >> flavors.text
echo Banana >> flavors.text
echo Cherry >> flavors.text
cat flavors.text | gum search > selection.text
cat flavors.text | gum filter > selection.text
```
#### Progress

View file

@ -27,7 +27,7 @@ echo "What's your favorite Gum flavor?"
GUM=$(echo "Cherry
Grape
Lime
Orange" | gum search)
Orange" | gum filter)
echo "One sec, while I finish my drink."

View file

@ -1,4 +1,4 @@
package search
package filter
import (
"fmt"
@ -13,8 +13,8 @@ import (
"github.com/charmbracelet/lipgloss"
)
// Run provides a shell script interface for the search bubble.
// https://github.com/charmbracelet/bubbles/search
// Run provides a shell script interface for filtering through options, powered
// by the textinput bubble.
func (o Options) Run() {
i := textinput.New()
i.Focus()

View file

@ -1,4 +1,4 @@
package search
package filter
import (
"strings"

View file

@ -1,6 +1,6 @@
package search
package filter
// Options is the customization options for the search.
// Options is the customization options for the filter command.
type Options struct {
HighlightColor string `help:"Color for highlighted matches" default:"212"`
Indicator string `help:"Character for selection" default:"•"`

8
gum.go
View file

@ -1,10 +1,10 @@
package main
import (
"github.com/charmbracelet/gum/filter"
"github.com/charmbracelet/gum/input"
"github.com/charmbracelet/gum/join"
"github.com/charmbracelet/gum/progress"
"github.com/charmbracelet/gum/search"
"github.com/charmbracelet/gum/spin"
"github.com/charmbracelet/gum/style"
"github.com/charmbracelet/gum/write"
@ -32,7 +32,7 @@ type Gum struct {
//
Write write.Options `cmd:"" help:"Prompt for multi-line input."`
// Search provides a fuzzy searching text input to allow filtering a list of
// Filter provides a fuzzy searching text input to allow filtering a list of
// options to select one option.
//
// By default it will list all the files (recursively) in the current directory
@ -41,9 +41,9 @@ type Gum struct {
//
// I.e. let's pick from a list of gum flavors:
//
// $ cat flavors.text | gum search
// $ cat flavors.text | gum filter
//
Search search.Options `cmd:"" help:"Fuzzy search options."`
Filter filter.Options `cmd:"" help:"Filter options through fuzzy search."`
// Spin provides a shell script interface for the spinner bubble.
// https://github.com/charmbracelet/bubbles/spinner

View file

@ -23,8 +23,8 @@ func main() {
gum.Input.Run()
case "write":
gum.Write.Run()
case "search":
gum.Search.Run()
case "filter":
gum.Filter.Run()
case "spin <command>":
gum.Spin.Run()
case "progress":