Skip to content

Commit

Permalink
fixed slice allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
elliot40404 committed Jan 9, 2025
1 parent 4cbf351 commit d335935
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
)

const (
Version = "0.0.3"
Version = "0.0.4"
Author = "elliot40404<avishek40404@gmail.com>"
Name = "modo"
Desc = "Modo is a simple cli app that lets you interact any text file that contains checkboxes in the markdown format."
Expand Down
14 changes: 6 additions & 8 deletions internal/renderer/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@ import (
)

type Renderer struct {
List []parser.Todo
File *os.File
Selected []int
List []parser.Todo
File *os.File
}

func NewRenderer(list []parser.Todo, file *os.File) *Renderer {
return &Renderer{
List: list,
File: file,
Selected: make([]int, 0),
List: list,
File: file,
}
}

func (r Renderer) Render() {
options := make([]huh.Option[int], len(r.List))
options := make([]huh.Option[int], 0, len(r.List))
for i, todo := range r.List {
options = append(options, huh.NewOption(todo.Content, i).Selected(todo.Done))
}
out := make([]int, 0)
out := make([]int, 0, len(r.List))
form := huh.NewForm(
huh.NewGroup(huh.NewMultiSelect[int]().
Title("Todos").
Expand Down

0 comments on commit d335935

Please sign in to comment.