command.go
This file
Path
style/command.go
37 lines · 974 bytes · Go
Last changed by
chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06
History of this fileTake it
The walk stopped after 200 commits: lines older than 6837ed2 point at it.
feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 1–11why, one step back1// Package style provides a shell script interface for Lip Gloss.2// https://github.com/charmbracelet/lipgloss3//4// It allows you to use Lip Gloss to style text without needing to use Go. All5// of the styling options are available as flags.6package style78import (9 "errors"10 "strings"11chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06
lines 12–13why, one step back12 "charm.land/gum/v2/internal/stdin"13 "charm.land/gum/v2/internal/tty"feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 14–22why, one step back14)1516// Run provides a shell script interface for the Lip Gloss styling.17// https://github.com/charmbracelet/lipgloss18func (o Options) Run() error {19 var text string20 if len(o.Text) > 0 {21 text = strings.Join(o.Text, "\n")22 } else {feat: --no-strip-ansi (#784)Carlos Alexandro Beckerbefore adoption4cedf9f
line 23why, one step back23 text, _ = stdin.Read(stdin.StripANSI(o.StripANSI))feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 24–27why, one step back24 if text == "" {25 return errors.New("no input provided, see `gum style --help`")26 }27 }feat(style): trim line spaces (#767)Carlos Alexandro Beckerbefore adoption2e53efc
lines 28–34why, one step back28 if o.Trim {29 var lines []string30 for _, line := range strings.Split(text, "\n") {31 lines = append(lines, strings.TrimSpace(line))32 }33 text = strings.Join(lines, "\n")34 }chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
line 35why, one step back35 tty.Println(o.Style.ToLipgloss().Render(text))feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 36–37why, one step back36 return nil37}