MCPcopy Create free account
hub / github.com/cloudflare/computer / runTokenDelete

Function runTokenDelete

packages/computer/src/artifacts/cli.ts:558–576  ·  view source on GitHub ↗
(client: ArtifactClient, args: string[])

Source from the content-addressed store, hash-verified

556}
557
558async 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

Callers 1

runTokenFunction · 0.85

Calls 6

argvErrorFunction · 0.85
okFunction · 0.85
mapErrorFunction · 0.85
parseFlagsFunction · 0.70
failFunction · 0.70
revokeTokenMethod · 0.65

Tested by

no test coverage detected