mirror of
https://github.com/charmbracelet/gum
synced 2024-05-17 05:36:42 +02:00
refactor: rename gum search
to gum filter
This commit is contained in:
parent
432d6dd032
commit
901e367fe2
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
|
||||
|
|
|
@ -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()
|
|
@ -1,4 +1,4 @@
|
|||
package search
|
||||
package filter
|
||||
|
||||
import (
|
||||
"strings"
|
|
@ -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
8
gum.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue