(plugin, params: CliData)
| 130 | }, |
| 131 | }, |
| 132 | async handler(plugin, params: CliData): Promise<string> { |
| 133 | const action = parseAction(params.action); |
| 134 | const duration = parseDuration(params.duration); |
| 135 | |
| 136 | switch (action) { |
| 137 | case "status": |
| 138 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 139 | case "start": { |
| 140 | const task = await resolvePomodoroTask(plugin, params, false); |
| 141 | await plugin.pomodoroService.startPomodoro(task, duration); |
| 142 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 143 | } |
| 144 | case "pause": |
| 145 | await plugin.pomodoroService.pausePomodoro(); |
| 146 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 147 | case "resume": |
| 148 | await plugin.pomodoroService.resumePomodoro(); |
| 149 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 150 | case "stop": |
| 151 | await plugin.pomodoroService.stopPomodoro(); |
| 152 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 153 | case "short-break": |
| 154 | await plugin.pomodoroService.startBreak(false); |
| 155 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 156 | case "long-break": |
| 157 | await plugin.pomodoroService.startBreak(true); |
| 158 | return formatCliJson(await formatPomodoroState(plugin, plugin.pomodoroService.getState())); |
| 159 | } |
| 160 | }, |
| 161 | }; |
nothing calls this directly
no test coverage detected