dhth / omm

"on-my-mind": A keyboard-driven task manager for the command line
https://tools.dhruvs.space/omm
MIT License
255 stars 3 forks source link

panic: `omm guide` #17

Open johnmee opened 4 months ago

johnmee commented 4 months ago

Describe the bug guide cli parameter creates a panic

Setup

To Reproduce

  1. type omm guide on the command line
  2. Error occurs

Expected behavior Text to stdout

Screenshots image

Additional context

$ omm guide Caught panic:

runtime error: index out of range [-1]

Restoring terminal...

goroutine 1 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/debug/stack.go:24 +0x83 runtime/debug.PrintStack() /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/debug/stack.go:16 +0x1a github.com/charmbracelet/bubbletea.(Program).Run.func1() /home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.6/tea.go:479 +0xbc panic({0x87f81a0, 0xb2edfb0}) /opt/hostedtoolcache/go/1.22.5/x64/src/runtime/panic.go:770 +0x103 github.com/dhth/omm/internal/types.GetDynamicStyle({0xb35c100, 0x6}) /home/runner/work/omm/omm/internal/types/types.go:158 +0x109 github.com/dhth/omm/internal/ui.compactItemDelegate.Render({{0x941cc00, 0x400, {0x0, 0x0}, 0x0, {0x8f9c90c, 0xb6150f8}, {0x0, 0x0}, 0x0, ...}}, ...) /home/runner/work/omm/omm/internal/ui/list_delegate.go:33 +0xd8 github.com/charmbracelet/bubbles/list.Model.populatedView({0x1, 0x1, 0x1, 0x1, 0x0, 0x1, {0x882673e, 0x4}, {0x8827957, 0x5}, ...}) /home/runner/go/pkg/mod/github.com/charmbracelet/bubbles@v0.18.0/list/list.go:1185 +0x2f0 github.com/charmbracelet/bubbles/list.Model.View({0x1, 0x1, 0x1, 0x1, 0x0, 0x1, {0x882673e, 0x4}, {0x8827957, 0x5}, ...}) /home/runner/go/pkg/mod/github.com/charmbracelet/bubbles@v0.18.0/list/list.go:1036 +0x47f github.com/dhth/omm/internal/ui.model.View({0xb0ab0e8, {0x0, {0x882b85e, 0x7}, {0x882b865, 0x7}, {0x0, 0x0}, {0x882f9f9, 0x9}, ...}, ...}) /home/runner/work/omm/omm/internal/ui/view.go:49 +0x10e8 github.com/charmbracelet/bubbletea.(Program).eventLoop(0xb0c5e00, {0x8f9d290, 0xb4e6000}, 0xb26abc0) /home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.6/tea.go:414 +0x6ee github.com/charmbracelet/bubbletea.(Program).Run(0xb0c5e00) /home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.6/tea.go:550 +0xa9d github.com/dhth/omm/internal/ui.RenderUI(0xb0ab0e8, {0x0, {0x882b85e, 0x7}, {0x882b865, 0x7}, {0x0, 0x0}, {0x882f9f9, 0x9}, ...}) /home/runner/work/omm/omm/internal/ui/ui.go:24 +0x244 github.com/dhth/omm/cmd.NewRootCommand.func6(0xb442d88, {0x944d6c0, 0x0, 0x0}) /home/runner/work/omm/omm/cmd/root.go:340 +0x1d6 github.com/spf13/cobra.(Command).execute(0xb442d88, {0x944d6c0, 0x0, 0x0}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaa0 github.com/spf13/cobra.(Command).ExecuteC(0xb442908) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x458 github.com/spf13/cobra.(Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 github.com/dhth/omm/cmd.Execute({0x8f9a044, 0x5}) /home/runner/work/omm/omm/cmd/root.go:62 +0xd4 main.main() /home/runner/work/omm/omm/main.go:20 +0x68

dhth commented 4 months ago

Does it only panic when running the guide, or during general usage as well (ie, when you run omm and try to add a task)?

johnmee commented 4 months ago

Only when adding the "guide" parameter. Not during general usage. Not for omm updates.

dhth commented 3 months ago

Hey @johnmee. Could you verify that this issue is fixed in v0.5.1? Thanks.