MCPcopy
hub / github.com/prisma/prisma / parse

Method parse

packages/cli/src/postgres/PostgresCommand.ts:34–55  ·  view source on GitHub ↗
(argv: string[], config: PrismaConfigInternal, baseDir: string)

Source from the content-addressed store, hash-verified

32 private constructor(private readonly cmds: Commands) {}
33
34 public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> {
35 const args = arg(argv, {
36 '--help': Boolean,
37 '-h': '--help',
38 '--telemetry-information': String,
39 })
40
41 if (isError(args)) {
42 return this.help(args.message)
43 }
44
45 if (args._.length === 0 || args['--help']) {
46 return this.help()
47 }
48
49 const cmd = this.cmds[args._[0]]
50 if (cmd) {
51 return cmd.parse(args._.slice(1), config, baseDir)
52 }
53
54 return unknownCommand(PostgresCommand.help, args._[0])
55 }
56
57 public help(error?: string): string | HelpError {
58 if (error) {

Callers

nothing calls this directly

Calls 6

helpMethod · 0.95
argFunction · 0.90
isErrorFunction · 0.90
unknownCommandFunction · 0.90
parseMethod · 0.65
sliceMethod · 0.45

Tested by

no test coverage detected