(client: ArtifactClient, args: string[])
| 556 | } |
| 557 | |
| 558 | async function runTokenDelete(client: ArtifactClient, args: string[]): Promise<ArtifactsCLIResult> { |
| 559 | const parsed = parseFlags(args, {}); |
| 560 | if ("error" in parsed) return argvError("token delete", parsed.error); |
| 561 | const [repo, tokenOrId] = parsed.positional; |
| 562 | if (repo === undefined) return argvError("token delete", "missing <repo>"); |
| 563 | if (tokenOrId === undefined) return argvError("token delete", "missing <id>"); |
| 564 | if (parsed.positional.length > 2) { |
| 565 | return argvError("token delete", `unexpected argument '${parsed.positional[2]}'`); |
| 566 | } |
| 567 | try { |
| 568 | const revoked = await client.revokeToken(repo, tokenOrId); |
| 569 | if (!revoked) { |
| 570 | return fail(`artifacts token delete: could not revoke token in '${repo}'`); |
| 571 | } |
| 572 | return ok("Revoked token\n"); |
| 573 | } catch (cause) { |
| 574 | return mapError("token delete", cause); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | // --------------------------------------------------------------- |
| 579 | // help text |
no test coverage detected