| 26 | /** The `gh event subscription` subcommand a call ran, or "api" for a `gh api` call on the subscriptions API. Help |
| 27 | * requests are not counted. */ |
| 28 | export function subscriptionCommand(call: Call): "list" | "view" | "create" | "delete" | "api" | undefined { |
| 29 | if (call.kind !== "gh") return; |
| 30 | const { words, help } = command(call.arguments); |
| 31 | if (help) return; |
| 32 | if (words[0] === "event" && (words[1] === "subscription" || words[1] === "subscriptions")) { |
| 33 | const sub = words[2] === "ls" ? "list" : words[2]; |
| 34 | if (sub === "list" || sub === "view" || sub === "create" || sub === "delete") return sub; |
| 35 | } |
| 36 | if (words[0] === "api" && /^\/?event-subscriptions(?:[/?]|$)/.test(words[1] ?? "")) return "api"; |
| 37 | } |
| 38 | |
| 39 | /** Whether a listener keeps listening after its first event, with `--follow` or a `--count` above 1. */ |
| 40 | export function persistentWait(call: Call): boolean { |