(msg tea.KeyMsg)
| 115 | } |
| 116 | |
| 117 | func (f FirstTimeSetup) handleGitignoreKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 118 | switch msg.String() { |
| 119 | case "q", "ctrl+c", "esc": |
| 120 | f.result.Cancelled = true |
| 121 | return f, tea.Quit |
| 122 | |
| 123 | case "up", "k", "left", "h": |
| 124 | if f.gitignoreSelected > 0 { |
| 125 | f.gitignoreSelected-- |
| 126 | } |
| 127 | return f, nil |
| 128 | |
| 129 | case "down", "j", "right", "l": |
| 130 | if f.gitignoreSelected < 1 { |
| 131 | f.gitignoreSelected++ |
| 132 | } |
| 133 | return f, nil |
| 134 | |
| 135 | case "y", "Y": |
| 136 | f.gitignoreSelected = 0 |
| 137 | return f.confirmGitignore() |
| 138 | |
| 139 | case "n", "N": |
| 140 | f.gitignoreSelected = 1 |
| 141 | return f.confirmGitignore() |
| 142 | |
| 143 | case "enter": |
| 144 | return f.confirmGitignore() |
| 145 | } |
| 146 | return f, nil |
| 147 | } |
| 148 | |
| 149 | func (f FirstTimeSetup) confirmGitignore() (tea.Model, tea.Cmd) { |
| 150 | if f.gitignoreSelected == 0 { |
no test coverage detected