mirror of
https://github.com/charmbracelet/gum
synced 2024-06-28 02:00:07 +02:00
Merge remote-tracking branch 'origin/feature/choose/Allow_User_to_select_or_enter_extra_value' into feature/choose/Allow_User_to_select_or_enter_extra_value
This commit is contained in:
commit
dd81ad0406
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
|
@ -4,7 +4,6 @@ updates:
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "08:00"
|
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
commit-message:
|
commit-message:
|
||||||
|
@ -14,7 +13,6 @@ updates:
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "08:00"
|
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
commit-message:
|
commit-message:
|
||||||
|
|
|
@ -6,16 +6,27 @@
|
||||||
package style
|
package style
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
|
"github.com/charmbracelet/gum/internal/stdin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run provides a shell script interface for the Lip Gloss styling.
|
// Run provides a shell script interface for the Lip Gloss styling.
|
||||||
// https://github.com/charmbracelet/lipgloss
|
// https://github.com/charmbracelet/lipgloss
|
||||||
func (o Options) Run() error {
|
func (o Options) Run() error {
|
||||||
text := strings.Join(o.Text, "\n")
|
var text string
|
||||||
|
if len(o.Text) > 0 {
|
||||||
|
text = strings.Join(o.Text, "\n")
|
||||||
|
} else {
|
||||||
|
text, _ = stdin.Read()
|
||||||
|
if text == "" {
|
||||||
|
return errors.New("no input provided, see `gum style --help`")
|
||||||
|
}
|
||||||
|
text = strings.TrimSuffix(text, "\n")
|
||||||
|
}
|
||||||
fmt.Println(o.Style.ToLipgloss().Render(text))
|
fmt.Println(o.Style.ToLipgloss().Render(text))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue