diff --git a/README.md b/README.md index 5594c82..c8668e2 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ export GUM_INPUT_WIDTH=80 gum input ``` -Gum input displaying most customization options +Gum input displaying most customization options ## Input @@ -141,7 +141,7 @@ gum input > answer.txt gum input --password > password.txt ``` -Shell running gum input typing Not much, you? +Shell running gum input typing Not much, you? ## Write @@ -151,7 +151,7 @@ Prompt for some multi-line text (`ctrl+d` to complete text entry). gum write > story.txt ``` -Shell running gum write typing a story +Shell running gum write typing a story ## Filter @@ -164,7 +164,7 @@ echo Cherry >> flavors.txt gum filter < flavors.txt > selection.txt ``` -Shell running gum filter on different bubble gum flavors +Shell running gum filter on different bubble gum flavors Select multiple options with the `--limit` flag or `--no-limit` flag. Use `tab` or `ctrl+space` to select, `enter` to confirm. @@ -191,7 +191,7 @@ cat songs.txt | gum choose --limit 5 cat foods.txt | gum choose --no-limit --header "Grocery Shopping" ``` -Shell running gum choose with numbers and gum flavors +Shell running gum choose with numbers and gum flavors ## Confirm @@ -202,7 +202,7 @@ Confirm whether to perform an action. Exits with code `0` (affirmative) or `1` gum confirm && rm file.txt || echo "File not removed" ``` -Shell running gum confirm +Shell running gum confirm ## File @@ -212,7 +212,7 @@ Prompt the user to select a file from the file tree. EDITOR $(gum file $HOME) ``` -Shell running gum file +Shell running gum file ## Pager @@ -222,7 +222,7 @@ Scroll through a long document with line numbers and a fully customizable viewpo gum pager < README.md ``` -Shell running gum pager +Shell running gum pager ## Spin @@ -235,7 +235,7 @@ To view or pipe the command's output, use the `--show-output` flag. gum spin --spinner dot --title "Buying Bubble Gum..." -- sleep 5 ``` -Shell running gum spin while sleeping for 5 seconds +Shell running gum spin while sleeping for 5 seconds Available spinner types include: `line`, `dot`, `minidot`, `jump`, `pulse`, `points`, `globe`, `moon`, `monkey`, `meter`, `hamburger`. @@ -247,7 +247,7 @@ Select a row from some tabular data. gum table < flavors.csv | cut -d ',' -f 1 ``` -Shell running gum table + ## Style @@ -260,7 +260,7 @@ gum style \ 'Bubble Gum (1¢)' 'So sweet and so fresh!' ``` -Bubble Gum, So sweet and so fresh! +Bubble Gum, So sweet and so fresh! ## Join @@ -281,7 +281,7 @@ BUBBLE_GUM=$(gum join "$BUBBLE" "$GUM") gum join --align center --vertical "$I_LOVE" "$BUBBLE_GUM" ``` -I LOVE Bubble Gum written out in four boxes with double borders around them. +I LOVE Bubble Gum written out in four boxes with double borders around them. ## Format @@ -308,7 +308,7 @@ For more information on template helpers, see the [Termenv docs](https://github.com/muesli/termenv#template-helpers). For a full list of named emojis see the [GitHub API](https://api.github.com/emojis). -Running gum format for different types of formats +Running gum format for different types of formats ## Log diff --git a/examples/.gitignore b/examples/.gitignore index 2d0c929..a8af5e2 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -1 +1,2 @@ *.gif +*.png diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..5200bac --- /dev/null +++ b/examples/README.md @@ -0,0 +1,36 @@ +# Glamour + +A casual introduction. 你好世界! + +## Let's talk about artichokes + +The artichoke is mentioned as a garden +plant in the 8th century BC by Homer +and Hesiod. The naturally occurring +variant of the artichoke, the cardoon, +which is native to the Mediterranean +area, also has records of use as a +food among the ancient Greeks and +Romans. Pliny the Elder mentioned +growing of 'carduus' in Carthage +and Cordoba. + +He holds him with his skinny hand, +There was ship,' quoth he. +'Hold off! unhand me, grey-beard loon!' +An artichoke dropt he. + +## Other foods worth mentioning + +1. Carrots +2. Celery +3. Tacos +• Soft +• Hard +4. Cucumber + +## Things to eat today + +* Carrots +* Ramen +* Currywurst diff --git a/examples/choose.tape b/examples/choose.tape new file mode 100644 index 0000000..b09df07 --- /dev/null +++ b/examples/choose.tape @@ -0,0 +1,26 @@ +Output choose.gif + +Set Width 1000 +Set Height 430 +Set Shell bash + +Type "gum choose {1..5}" +Sleep 500ms +Enter +Sleep 500ms +Down@250ms 3 +Sleep 500ms +Up@250ms 2 +Enter +Sleep 1.5s +Ctrl+L +Sleep 500ms +Type "gum choose --limit 2 Banana Cherry Orange" +Sleep 500ms +Enter +Sleep 500ms +Type@250ms "jxjxk" +Sleep 1s +Enter +Sleep 2s + diff --git a/examples/confirm.tape b/examples/confirm.tape new file mode 100644 index 0000000..9cac1f0 --- /dev/null +++ b/examples/confirm.tape @@ -0,0 +1,26 @@ +Output confirm.gif + +Set Width 1000 +Set Height 350 +Set Shell bash + +Sleep 500ms +Type "gum confirm && echo 'Me too!' || echo 'Me neither.'" +Sleep 1s +Enter +Sleep 1s +Right +Sleep 500ms +Left +Sleep 500ms +Enter +Sleep 1.5s +Ctrl+L +Type "gum confirm && echo 'Me too!' || echo 'Me neither.'" +Sleep 500ms +Enter +Sleep 500ms +Right +Sleep 500ms +Enter +Sleep 1s diff --git a/examples/customize.tape b/examples/customize.tape new file mode 100644 index 0000000..df307e8 --- /dev/null +++ b/examples/customize.tape @@ -0,0 +1,19 @@ +Output customize.gif + +Set Width 1000 +Set Height 350 +Set Shell bash + +Sleep 1s +Type `gum input --cursor.foreground "#F4AC45" \` Enter +Type `--prompt.foreground "#04B575" --prompt "What's up? " \` Enter +Type `--placeholder "Not much, you?" --value "Not much, you?" \` Enter +Type `--width 80` Enter +Sleep 1s +Ctrl+A +Sleep 1s +Ctrl+E +Sleep 1s +Ctrl+U +Sleep 1s + diff --git a/examples/fav.txt b/examples/fav.txt new file mode 100644 index 0000000..26182c7 --- /dev/null +++ b/examples/fav.txt @@ -0,0 +1 @@ +Banana diff --git a/examples/file.tape b/examples/file.tape new file mode 100644 index 0000000..43c68ff --- /dev/null +++ b/examples/file.tape @@ -0,0 +1,15 @@ +Output file.gif +Set Width 800 +Set Height 525 +Set Shell bash + +Type "gum file .." +Enter +Sleep 1s +Down@150ms 6 +Sleep 1s +Enter +Sleep 1s +Type "j" +Sleep 1s + diff --git a/examples/flavors.txt b/examples/flavors.txt new file mode 100644 index 0000000..a436a92 --- /dev/null +++ b/examples/flavors.txt @@ -0,0 +1,4 @@ +Banana +Cherry +Orange +Strawberry diff --git a/examples/format.ansi b/examples/format.ansi new file mode 100644 index 0000000..b739238 --- /dev/null +++ b/examples/format.ansi @@ -0,0 +1,12 @@ +> gum format -t code < main.go + + +   package main +    +   import "fmt" +    +   func main() { +    fmt.Println("Charm_™ Gum") +   } +    + diff --git a/examples/input.tape b/examples/input.tape new file mode 100644 index 0000000..aceb49e --- /dev/null +++ b/examples/input.tape @@ -0,0 +1,16 @@ +Output input.gif + +Set Width 800 +Set Height 250 +Set Shell bash + +Sleep 1s +Type `gum input --placeholder "What's up?"` +Sleep 1s +Enter +Sleep 1s +Type "Not much, you?" +Sleep 1s +Enter +Sleep 1s + diff --git a/examples/main.go b/examples/main.go new file mode 100644 index 0000000..bdabe9e --- /dev/null +++ b/examples/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Charm_™ Gum") +} diff --git a/examples/pager.tape b/examples/pager.tape new file mode 100644 index 0000000..aff6b92 --- /dev/null +++ b/examples/pager.tape @@ -0,0 +1,15 @@ +Output pager.gif + +Set Shell bash +Set Width 900 +Set Height 750 + +Sleep 1s +Type "gum pager < README.md" +Enter +Sleep 1.5s +Down@100ms 25 +Sleep 1s +Up@100ms 25 +Sleep 3s + diff --git a/examples/spin.tape b/examples/spin.tape new file mode 100644 index 0000000..1f92e22 --- /dev/null +++ b/examples/spin.tape @@ -0,0 +1,13 @@ +Output spin.gif + +Set Shell bash +Set Width 1200 +Set Height 300 +Set FontSize 36 + +Sleep 500ms +Type `gum spin --title "Buying Gum..." -- sleep 5` +Sleep 1s +Enter +Sleep 4s + diff --git a/examples/story.txt b/examples/story.txt new file mode 100644 index 0000000..c5a3c85 --- /dev/null +++ b/examples/story.txt @@ -0,0 +1,2 @@ +Once upon a time +In a land far, far away.... diff --git a/examples/write.tape b/examples/write.tape new file mode 100644 index 0000000..8328555 --- /dev/null +++ b/examples/write.tape @@ -0,0 +1,21 @@ +Output write.gif + +Set Width 800 +Set Height 350 +Set Shell bash + +Sleep 500ms +Type "gum write > story.txt" +Enter +Sleep 1s +Type "Once upon a time" +Sleep 1s +Alt+Enter +Type "In a land far, far away...." +Sleep 500ms +Enter +Sleep 1s +Type "cat story.txt" +Enter +Sleep 2s + diff --git a/input/command.go b/input/command.go index 17f38ff..c02f65c 100644 --- a/input/command.go +++ b/input/command.go @@ -14,7 +14,6 @@ import ( // Run provides a shell script interface for the text input bubble. // https://github.com/charmbracelet/bubbles/textinput func (o Options) Run() error { - var value string if o.Value != "" { value = o.Value