1// Based on the implementation by @trashhalo at:
2// https://github.com/trashhalo/imgcat
10 tea "charm.land/bubbletea/v2"
21func New(width, height uint, url string) Model {
29func (m Model) Init() tea.Cmd {
33func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
34 switch msg := msg.(type) {
42 return m, loadURL(m.url)
44 return handleLoadMsg(m, msg)
49func (m Model) View() string {
51 return fmt.Sprintf("couldn't load image(s): %v", m.err)
56type errMsg struct{ error }
58func (m Model) Redraw(width uint, height uint, url string) tea.Cmd {
59 return func() tea.Msg {
68func (m Model) UpdateURL(url string) tea.Cmd {
69 return func() tea.Msg {
78type redrawMsg struct {
84func (m Model) IsLoading() bool {
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list