Procházet zdrojové kódy

Minor documentation updates for tui

arianagiroux před 2 týdny
rodič
revize
42d4f40716
1 změnil soubory, kde provedl 14 přidání a 6 odebrání
  1. 14 6
      tui.go

+ 14 - 6
tui.go

@@ -67,7 +67,7 @@ type Model struct {
 // The bubbletea init function
 func (m Model) Init() tea.Cmd { return m.load }
 
-// Handles quit logic and viewport scroll and size updates
+// Core tea.Model update loop
 func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 	// widget specifc keyhandling
 	var cmds []tea.Cmd
@@ -177,7 +177,7 @@ type create struct {
 	Err         error // not implemented
 }
 
-// constructor for createIssue widget
+// constructor for create widget
 func initialCreateModel(path string, placeholder string) create {
 	spawnInput := func(f bool) textinput.Model {
 		ti := textinput.New()
@@ -220,10 +220,12 @@ func initialCreateModel(path string, placeholder string) create {
 	}
 }
 
+// init cmd for create widget
 func (c create) init() tea.Cmd {
 	return textinput.Blink
 }
 
+// update cmd for create widget
 func (c create) update(msg tea.Msg) (create, tea.Cmd) {
 	var cmds []tea.Cmd
 	var cmd tea.Cmd
@@ -304,6 +306,7 @@ func (c create) update(msg tea.Msg) (create, tea.Cmd) {
 	return c, tea.Batch(cmds...)
 }
 
+// render cmd for create widget
 func (c create) render() tea.Msg {
 	borderStyle := lipgloss.NewStyle().
 		BorderStyle(lipgloss.NormalBorder()).
@@ -338,6 +341,7 @@ func (c create) render() tea.Msg {
 	return output
 }
 
+// keyhelp cmd for create widget
 func (c create) keyhelp() string {
 	var output string
 	output = output + "\ntab/shift+tab: down/up\t\tenter: input value\t\tctrl+c: quit"
@@ -347,7 +351,7 @@ func (c create) keyhelp() string {
 // -------- Issue widget definitions ------------------------------------------
 // ----------------------------------------------------------------------------
 
-// Handles all render logic for Issue structs
+// render cmd for Issue widget
 func (i Issue) render() tea.Msg {
 	var output string
 	// title
@@ -386,6 +390,7 @@ func (i Issue) render() tea.Msg {
 	return borderStyle.Render(output)
 }
 
+// keyhelp cmd for Issue widget
 func (i Issue) keyhelp() string {
 	var output string
 	output = output + "\nj/k: down/up\t\tq: quit"
@@ -395,7 +400,7 @@ func (i Issue) keyhelp() string {
 // -------- IssueCollection widget definitions --------------------------------
 // ----------------------------------------------------------------------------
 
-// Handles all render logic for IssueCollection structs.
+// render cmd for IssueCollection widget
 func (ic IssueCollection) render() tea.Msg {
 	var output string
 	var left string
@@ -418,6 +423,7 @@ func (ic IssueCollection) render() tea.Msg {
 	return output
 }
 
+// keyhelp cmd for IssueCollection widget
 func (ic IssueCollection) keyhelp() string {
 	var output string
 	output = output + "\nj/k: down/up\t\tenter: select\t\tq: quit"
@@ -452,11 +458,12 @@ func (m Model) load() tea.Msg {
 	return initialCreateModel(m.Path, "lorem ipsum")
 }
 
+// type wrapper for create.create() result
 type createResult Issue
 
 // TODO implement description field in createIssue.create cmd
 
-// A widget for creating issues
+// A tea.Cmd to translate create.inputs to a new Issue object
 func (c create) create() tea.Msg {
 	data := make(map[string]string)
 	commaSplit := func(t string) []string {
@@ -510,9 +517,10 @@ func (c create) create() tea.Msg {
 	return createResult(newIssue)
 }
 
+// type wrapper for create.write() result
 type writeResult any
 
-// Wraps a cmd func, passes an initialized Issue to WriteIssue()
+// Wraps a tea.Cmd func, passes an initialized Issue to WriteIssue()
 func (c create) write(issue Issue) tea.Cmd {
 	return func() tea.Msg {
 		result, err := WriteIssue(issue, false)