Skip to content

Commit

Permalink
wip: beta
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed May 24, 2024
1 parent 99559f9 commit 1a7ac6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bubbletea/tea_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func makeOpts(s ssh.Session) []tea.ProgramOption {
return []tea.ProgramOption{
tea.WithInput(s),
tea.WithOutput(s),
tea.WithEnvironment(s.Environ()),
tea.WithEnvironment(append(s.Environ(), "CLICOLOR_FORCE=1")),
}
}

Expand Down
11 changes: 9 additions & 2 deletions examples/bubbletea/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (m model) Init(ctx tea.Context) (tea.Model, tea.Cmd) {
return m, nil
}

func (m model) Update(ctx tea.Context, msg tea.Msg) (tea.Model, tea.Cmd) {
func (m model) Update(_ tea.Context, msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.height = msg.Height
Expand All @@ -115,6 +115,13 @@ func (m model) Update(ctx tea.Context, msg tea.Msg) (tea.Model, tea.Cmd) {
}

func (m model) View(tea.Context) string {
s := fmt.Sprintf("Your term is %s\nYour window size is %dx%d\nBackground: %s\nColor Profile: %s", m.term, m.width, m.height, m.bg, m.profile)
s := fmt.Sprintf(
"Your term is %s\nYour window size is %dx%d\nBackground: %s\nColor Profile: %s",
m.term,
m.width,
m.height,
m.bg,
m.profile,
)
return m.txtStyle.Render(s) + "\n\n" + m.quitStyle.Render("Press 'q' to quit\n")
}

0 comments on commit 1a7ac6b

Please sign in to comment.