forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.command.ts
More file actions
39 lines (35 loc) · 1.57 KB
/
Copy pathlink.command.ts
File metadata and controls
39 lines (35 loc) · 1.57 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
39
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
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 { legacyLink } from "./link.handler.ts";
const config = {
projectRef: Flag.string("project-ref").pipe(
Flag.withDescription("Project ref of the Supabase project."),
Flag.optional,
),
password: Flag.string("password").pipe(
Flag.withAlias("p"),
Flag.withDescription("Password to your remote Postgres database."),
Flag.optional,
),
skipPooler: Flag.boolean("skip-pooler").pipe(
Flag.withDescription("Use direct connection instead of pooler."),
),
} as const;
export type LegacyLinkFlags = CliCommand.Command.Config.Infer<typeof config>;
export const legacyLinkCommand = Command.make("link", config).pipe(
Command.withDescription("Link to a Supabase project."),
Command.withShortDescription("Link to a Supabase project"),
Command.withHandler((flags) =>
legacyLink(flags).pipe(
// Only `--project-ref` is `markFlagTelemetrySafe` in Go (cmd/link.go:52).
// The boolean `--skip-pooler` is logged verbatim regardless; `--password`
// stays redacted.
withLegacyCommandInstrumentation({ flags, safeFlags: ["project-ref"] }),
withJsonErrorHandling,
),
),
Command.provide(legacyManagementApiRuntimeLayer(["link"])),
);