(host: SlashCommandHost, args: string)
| 121 | } |
| 122 | |
| 123 | export async function handleGoalCommand(host: SlashCommandHost, args: string): Promise<void> { |
| 124 | const parsed = parseGoalCommand(args); |
| 125 | switch (parsed.kind) { |
| 126 | case 'error': |
| 127 | if (parsed.severity === 'hint') host.showStatus(parsed.message); |
| 128 | else host.showError(parsed.message); |
| 129 | return; |
| 130 | case 'status': |
| 131 | await showGoalStatus(host); |
| 132 | return; |
| 133 | case 'pause': |
| 134 | await pauseGoal(host); |
| 135 | return; |
| 136 | case 'resume': |
| 137 | await resumeGoal(host); |
| 138 | return; |
| 139 | case 'cancel': |
| 140 | await cancelGoal(host); |
| 141 | return; |
| 142 | case 'next-add': |
| 143 | await queueNextGoal(host, parsed); |
| 144 | return; |
| 145 | case 'next-manage': |
| 146 | await showGoalQueueManager(host); |
| 147 | return; |
| 148 | case 'create': |
| 149 | await createGoal(host, parsed, args); |
| 150 | return; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | function parseNextGoalCommand(tokens: readonly string[]): ParsedGoalCommand { |
| 155 | if (tokens.length === 2 && tokens[1] === 'manage') return { kind: 'next-manage' }; |
no test coverage detected