← back to jimbojd72__gopener

Function bodies 54 total

All specs Real LLM only Function bodies
New function · go · L24-L34 (11 LOC)
internal/tui/screens/setup/setup.go
func New(cfg *config.Config) Model {
	ti := textinput.New()
	ti.Placeholder = "/home/user/src"
	ti.Focus()
	ti.CharLimit = 256
	ti.Width = 50
	if cfg.SrcDir != "" {
		ti.SetValue(cfg.SrcDir)
	}
	return Model{cfg: cfg, input: ti}
}
Init method · go · L36-L38 (3 LOC)
internal/tui/screens/setup/setup.go
func (m Model) Init() tea.Cmd {
	return textinput.Blink
}
Update method · go · L40-L58 (19 LOC)
internal/tui/screens/setup/setup.go
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
	switch msg := msg.(type) {
	case tea.KeyMsg:
		switch msg.Type {
		case tea.KeyEnter:
			val := strings.TrimSpace(m.input.Value())
			if val == "" {
				m.err = "path cannot be empty"
				return m, nil
			}
			return m, func() tea.Msg { return DoneMsg{SrcDir: val} }
		case tea.KeyCtrlC:
			return m, tea.Quit
		}
	}
	var cmd tea.Cmd
	m.input, cmd = m.input.Update(msg)
	return m, cmd
}
View method · go · L60-L72 (13 LOC)
internal/tui/screens/setup/setup.go
func (m Model) View() string {
	title := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("205")).Render("gopener — first run setup")
	prompt := "Enter your source directory path:"
	inputView := m.input.View()
	help := lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render("Press Enter to confirm, Ctrl+C to quit")

	parts := []string{title, "", prompt, inputView}
	if m.err != "" {
		parts = append(parts, fmt.Sprintf("\n  error: %s", m.err))
	}
	parts = append(parts, "", help)
	return strings.Join(parts, "\n")
}
‹ prevpage 2 / 2