( command: 'install' | 'reinstall', positionals: string[], )
| 207 | } |
| 208 | |
| 209 | function resolveDeployTarget( |
| 210 | command: 'install' | 'reinstall', |
| 211 | positionals: string[], |
| 212 | ): { ok: true; app: string; appPathInput: string } | { ok: false; response: DaemonResponse } { |
| 213 | const first = positionals[0]?.trim(); |
| 214 | const second = positionals[1]?.trim(); |
| 215 | if (command === 'install') { |
| 216 | const appPathInput = second ?? first; |
| 217 | if (!appPathInput) { |
| 218 | return { |
| 219 | ok: false, |
| 220 | response: errorResponse('INVALID_ARGS', 'install requires: install <path-to-app-binary>'), |
| 221 | }; |
| 222 | } |
| 223 | return { ok: true, app: second ? (first ?? '') : '', appPathInput }; |
| 224 | } |
| 225 | |
| 226 | if (!first || !second) { |
| 227 | return { |
| 228 | ok: false, |
| 229 | response: errorResponse( |
| 230 | 'INVALID_ARGS', |
| 231 | 'reinstall requires: reinstall <app> <path-to-app-binary>', |
| 232 | ), |
| 233 | }; |
| 234 | } |
| 235 | return { ok: true, app: first, appPathInput: second }; |
| 236 | } |
no test coverage detected