forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.command.ts
More file actions
38 lines (35 loc) · 1.62 KB
/
Copy pathlist.command.ts
File metadata and controls
38 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
import { FUNCTIONS_PROJECT_REF_SAFE_FLAGS } from "../../../../shared/functions/functions.shared.ts";
import { withJsonErrorHandling } from "../../../../shared/output/json-error-handling.ts";
import { legacyManagementApiRuntimeLayer } from "../../../shared/legacy-management-api-runtime.layer.ts";
import { withLegacyCommandInstrumentation } from "../../../telemetry/legacy-command-instrumentation.ts";
import { legacyFunctionsList } from "./list.handler.ts";
const config = {
projectRef: Flag.string("project-ref").pipe(
Flag.withDescription("Project ref of the Supabase project."),
Flag.optional,
),
} as const;
export type LegacyFunctionsListFlags = CliCommand.Command.Config.Infer<typeof config>;
export const legacyFunctionsListCommand = Command.make("list", config).pipe(
Command.withDescription("List all Functions in the linked Supabase project."),
Command.withShortDescription("List all Functions in Supabase"),
Command.withExamples([
{
command: "supabase functions list",
description: "List all deployed functions in the linked project",
},
{
command: "supabase functions list --project-ref abcdefghijklmnopqrst",
description: "List all deployed functions in a specific project",
},
]),
Command.withHandler((flags) =>
legacyFunctionsList(flags).pipe(
withLegacyCommandInstrumentation({ flags, safeFlags: FUNCTIONS_PROJECT_REF_SAFE_FLAGS }),
withJsonErrorHandling,
),
),
Command.provide(legacyManagementApiRuntimeLayer(["functions", "list"])),
);