docs: TODO shuffling & remove dead code

This commit is contained in:
decentral1se 2023-05-10 15:14:36 +02:00
parent 54425e1ee0
commit e7ecaef0a4
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410

View File

@ -29,10 +29,6 @@ const minCharsUntilFilter = 2
var helpFlag bool var helpFlag bool
type Configuration struct {
ManualDir string
}
func handleCliFlags() { func handleCliFlags() {
flag.BoolVar(&helpFlag, "h", false, "output help") flag.BoolVar(&helpFlag, "h", false, "output help")
flag.Parse() flag.Parse()
@ -112,6 +108,7 @@ func initialModel() model {
return nil return nil
}) })
// TODO: set width/heigh to match terminal
viewp := viewport.New(60, 30) viewp := viewport.New(60, 30)
viewp.SetContent(ds[len(ds)-1].contents) viewp.SetContent(ds[len(ds)-1].contents)
@ -120,7 +117,6 @@ func initialModel() model {
datasheets: ds, datasheets: ds,
dataSheetViewport: viewp, dataSheetViewport: viewp,
} }
// TODO: which index is the datasheet closest to the filter input?
m.dataSheetsView = m.dataSheetNames() m.dataSheetsView = m.dataSheetNames()
return m return m
@ -155,11 +151,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.dataSheetsView = m.dataSheetNames() m.dataSheetsView = m.dataSheetNames()
} }
// TODO: implement cursor for scrolling up/down filtered
// results so we can view the PDF contents as desired
// it's currently just the last one (closed to input)
lastDatasheet := m.dataSheetsView[len(m.dataSheetsView)-1] lastDatasheet := m.dataSheetsView[len(m.dataSheetsView)-1]
viewportText := m.datasheetFromName(lastDatasheet) viewportText := m.datasheetFromName(lastDatasheet)
m.dataSheetViewport.SetContent(viewportText) m.dataSheetViewport.SetContent(viewportText)
} }
// TODO: handle terminal resizing
switch msg := msg.(type) { switch msg := msg.(type) {
case tea.KeyMsg: case tea.KeyMsg:
switch msg.String() { switch msg.String() {
@ -171,8 +171,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.filterInput, cmd = m.filterInput.Update(msg) m.filterInput, cmd = m.filterInput.Update(msg)
cmds = append(cmds, cmd) cmds = append(cmds, cmd)
// TODO figure out how update viewport when filtering
// the last item in m.dataSheetsView should be shown
m.dataSheetViewport, cmd = m.dataSheetViewport.Update(msg) m.dataSheetViewport, cmd = m.dataSheetViewport.Update(msg)
cmds = append(cmds, cmd) cmds = append(cmds, cmd)