31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { usageError } from "../../core/errors.js";
|
|
import type { CorpConfig } from "../../core/config/types.js";
|
|
import type { createSealClient } from "../../core/http/factory.js";
|
|
import { runCapability } from "../helpers.js";
|
|
import { outputOptions } from "../printer.js";
|
|
import type { ParsedArgs } from "../types.js";
|
|
|
|
export async function handleBillingCommand(
|
|
action: string | undefined,
|
|
client: Awaited<ReturnType<typeof createSealClient>>,
|
|
corp: CorpConfig,
|
|
args: ParsedArgs
|
|
) {
|
|
if (action === "status" || action === "get") {
|
|
await runCapability("sealBillingStatusGet", client, corp, {}, outputOptions(args.options));
|
|
return;
|
|
}
|
|
|
|
if (action === "plans") {
|
|
await runCapability("sealBillingPlansList", client, corp, {}, outputOptions(args.options));
|
|
return;
|
|
}
|
|
|
|
if (action === "features") {
|
|
await runCapability("sealBillingFeaturesList", client, corp, {}, outputOptions(args.options));
|
|
return;
|
|
}
|
|
|
|
throw usageError(`Unknown billing command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
|
|
}
|