made new todo struct
This commit is contained in:
parent
81f6e853c2
commit
30fd110277
@ -57,7 +57,7 @@ func (m model) View() string {
|
||||
s := "What should we buy at the market?\n\n"
|
||||
|
||||
// Iterate over our choices
|
||||
for i, choice := range m.choices {
|
||||
for i, choice := range m.list {
|
||||
|
||||
// Is the cursor pointing at this choice?
|
||||
cursor := " " // no cursor
|
||||
|
20
model.go
20
model.go
@ -1,17 +1,27 @@
|
||||
package main
|
||||
|
||||
type todo struct {
|
||||
name string
|
||||
done bool
|
||||
deadline int
|
||||
startdate int
|
||||
priority int // 1-4, 1 being highest priority, 4 being no priority
|
||||
}
|
||||
|
||||
type model struct {
|
||||
todos []string // ALL items on the to-do list
|
||||
list []string // items currently visible on the list right now
|
||||
todos []todo // ALL items on the to-do list
|
||||
list []todo // items currently visible on the list right now
|
||||
cursor int // which to-do list item our cursor is pointing at
|
||||
done map[int]struct{} // which to-do items are selected
|
||||
selected map[int]struct{} // which to-do items are selected
|
||||
tab int // which tab is selected
|
||||
}
|
||||
|
||||
func initialModel() model {
|
||||
return model{
|
||||
// Start empty
|
||||
todos: []string{},
|
||||
todos: []todo{},
|
||||
|
||||
list: []todo{},
|
||||
|
||||
// start on today tab
|
||||
// 0: inbox, 1: today, 2: tomorrow, 3: scheduled, 4: anytime
|
||||
@ -20,6 +30,6 @@ func initialModel() model {
|
||||
// A map which indicates which choices are selected. We're using
|
||||
// the map like a mathematical set. The keys refer to the indexes
|
||||
// of the `choices` slice, above.
|
||||
done: make(map[int]struct{}),
|
||||
selected: make(map[int]struct{}),
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user