mirror of
https://github.com/charmbracelet/gum
synced 2024-05-15 20:56:41 +02:00
docs: gum write
, gum join
This commit is contained in:
parent
ff1f02f470
commit
4557fe8406
56
README.md
56
README.md
|
@ -1,13 +1,12 @@
|
|||
# Gum
|
||||
|
||||
Tasty Bubble Gum for your shell.
|
||||
|
||||
Gum is a command-line tool (`gum`) that gives you the power of
|
||||
Gum is a collection of command-line utilities that make your shell scripts a
|
||||
little more glamorous. It gives you the power of
|
||||
[Bubbles](https://github.com/charmbracelet/bubbles) and
|
||||
[Lip Gloss](https://github.com/charmbracelet/lipgloss) without needing to write
|
||||
any Go code.
|
||||
|
||||
The following example is generated entirely from a [single bash script](./examples/demo.sh).
|
||||
The following example is running from a [single Bash script](./examples/demo.sh).
|
||||
|
||||
<img src="https://stuff.charm.sh/gum/gum.gif" width="900" alt="Shell running the Gum examples/demo.sh script">
|
||||
|
||||
|
@ -20,6 +19,14 @@ Prompt your users for input with a simple command.
|
|||
gum input > answer.text
|
||||
```
|
||||
|
||||
#### Write
|
||||
|
||||
Prompt your users to write some multi-line text.
|
||||
|
||||
```bash
|
||||
gum write > story.text
|
||||
```
|
||||
|
||||
#### Search
|
||||
|
||||
Allow your users to filter through a list of options by fuzzy searching.
|
||||
|
@ -31,7 +38,7 @@ echo Cherry >> flavors.text
|
|||
cat flavors.text | gum search > selection.text
|
||||
```
|
||||
|
||||
#### Loading
|
||||
#### Progress
|
||||
|
||||
Display a progress bar while loading. The following command will display a
|
||||
progress bar and increment the progress by 10% every 1 second. Thus, taking 10
|
||||
|
@ -51,27 +58,20 @@ command exits.
|
|||
gum spin --spinner dot --title "Buying Bubble Gum..." -- sleep 5
|
||||
```
|
||||
|
||||
```
|
||||
⣽ Buying Bubble Gum...
|
||||
```
|
||||
|
||||
|
||||
## Styling
|
||||
## Styling and Layout
|
||||
|
||||
#### Style
|
||||
Pretty print any string with any layout with one command.
|
||||
|
||||
```bash
|
||||
gum style \
|
||||
--foreground "#FF06B7" --border "double" --align "center" \
|
||||
--width 50 --margin 2 --padding "2 4" \
|
||||
--width 50 --margin "1 2" --padding "2 4" \
|
||||
"Bubble Gum (1¢)" "So sweet and so fresh\!"
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
|
||||
|
||||
╔══════════════════════════════════════════════════╗
|
||||
║ ║
|
||||
║ ║
|
||||
|
@ -80,10 +80,30 @@ Result:
|
|||
║ ║
|
||||
║ ║
|
||||
╚══════════════════════════════════════════════════╝
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
#### Join
|
||||
|
||||
Combine text vertically or horizontally with a single command, use this command
|
||||
with `gum style` to build layouts and pretty output.
|
||||
|
||||
Note: It's important to wrap the output of `gum style` in quotes to ensure new
|
||||
lines (`\n`) are part of a single argument passed to the `join` command.
|
||||
|
||||
```bash
|
||||
gum join "$(gum style --padding "1 5" --border double "I love Bubble Gum")" "$(gum style --padding "1 5" --border double "<3")"
|
||||
```
|
||||
|
||||
```
|
||||
╔═══════════════════════════╗╔════════════╗
|
||||
║ ║║ ║
|
||||
║ I love Bubble Gum ║║ <3 ║
|
||||
║ ║║ ║
|
||||
╚═══════════════════════════╝╚════════════╝
|
||||
```
|
||||
|
||||
|
||||
## Feedback
|
||||
|
||||
We’d love to hear your thoughts on this project. Feel free to drop us a note!
|
||||
|
@ -96,8 +116,6 @@ We’d love to hear your thoughts on this project. Feel free to drop us a note!
|
|||
|
||||
[MIT](https://github.com/charmbracelet/seashell/raw/main/LICENSE)
|
||||
|
||||
***
|
||||
|
||||
Part of [Charm](https://charm.sh).
|
||||
|
||||
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>
|
||||
|
|
4
gum.go
4
gum.go
|
@ -30,7 +30,7 @@ type Gum struct {
|
|||
//
|
||||
// $ gum write > output.text
|
||||
//
|
||||
Write write.Options `cmd:"" help:"Prompt for text"`
|
||||
Write write.Options `cmd:"" help:"Prompt for multi-line input."`
|
||||
|
||||
// Search provides a fuzzy searching text input to allow filtering a list of
|
||||
// options to select one option.
|
||||
|
@ -98,5 +98,5 @@ type Gum struct {
|
|||
// Join provides a shell script interface for the lipgloss JoinHorizontal
|
||||
// and JoinVertical commands.
|
||||
//
|
||||
Join join.Options `cmd:"" help:"Join text horizontally or vertically"`
|
||||
Join join.Options `cmd:"" help:"Join text horizontally or vertically."`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue