Skip to content
Myr

command.go

This file

Path

pager/command.go

59 lines · 1.5 KiB · Go

Last changed by

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

History of this file

Take 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–6why, one step back
1package pager
23import (4 "fmt"5 "regexp"6

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 7–9why, one step back
7 "charm.land/bubbles/v2/help"
8 "charm.land/bubbles/v2/viewport"9 tea "charm.land/bubbletea/v2"

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

lines 10–11why, one step back
10 "charm.land/gum/v2/internal/stdin"
11 "charm.land/gum/v2/internal/timeout"

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 12–16why, one step back
12)
1314// Run provides a shell script interface for the viewport bubble.15// https://github.com/charmbracelet/bubbles/viewport16func (o Options) Run() error {

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

line 17why, one step back
17 vp := viewport.New(viewport.WithWidth(o.Style.Width), viewport.WithHeight(o.Style.Height))

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 18–33why, one step back
18 vp.Style = o.Style.ToLipgloss()
1920 if o.Content == "" {21 stdin, err := stdin.Read()22 if err != nil {23 return fmt.Errorf("unable to read stdin")24 }25 if stdin != "" {26 // Sanitize the input from stdin by removing backspace sequences.27 backspace := regexp.MustCompile(".\x08")28 o.Content = backspace.ReplaceAllString(stdin, "")29 } else {30 return fmt.Errorf("provide some content to display")31 }32 }33

feat: handle interrupts and timeouts (#747)Carlos Alexandro Beckerbefore adoption4f46952

line 34why, one step back
34 m := model{

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

line 35why, one step back
35 viewport: vp,

fix(pager): use help bubble (#748)Carlos Alexandro Beckerbefore adoption2e2b020

line 36why, one step back
36 help: help.New(),

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 37–43why, one step back
37 content: o.Content,
38 origContent: o.Content,39 showLineNumbers: o.ShowLineNumbers,40 lineNumberStyle: o.LineNumberStyle.ToLipgloss(),41 softWrap: o.SoftWrap,42 matchStyle: o.MatchStyle.ToLipgloss(),43 matchHighlightStyle: o.MatchHighlightStyle.ToLipgloss(),

fix(pager): use help bubble (#748)Carlos Alexandro Beckerbefore adoption2e2b020

line 44why, one step back
44 keymap: defaultKeymap(),

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

line 45why, one step back
45 }

refactor: removing huh as a dep (#742)Carlos Alexandro Beckerbefore adoptione30fc5e

line 46why, one step back
46

feat: handle interrupts and timeouts (#747)Carlos Alexandro Beckerbefore adoption4f46952

lines 47–55why, one step back
47 ctx, cancel := timeout.Context(o.Timeout)
48 defer cancel()4950 _, err := tea.NewProgram(51 m,52 tea.WithContext(ctx),53 ).Run()54 if err != nil {55 return fmt.Errorf("unable to start program: %w", err)

refactor: removing huh as a dep (#742)Carlos Alexandro Beckerbefore adoptione30fc5e

lines 56–57why, one step back
56 }
57

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 58–59why, one step back
58 return nil
59}