(argv: string[], config: PrismaConfigInternal, baseDir: string = process.cwd())
| 46 | } |
| 47 | |
| 48 | async parse(argv: string[], config: PrismaConfigInternal, baseDir: string = process.cwd()): Promise<string | Error> { |
| 49 | const args = arg(argv, { |
| 50 | '--help': Boolean, |
| 51 | '-h': '--help', |
| 52 | '--schema': String, |
| 53 | '--config': String, |
| 54 | '--telemetry-information': String, |
| 55 | }) |
| 56 | |
| 57 | if (isError(args)) { |
| 58 | return this.help(args.message) |
| 59 | } |
| 60 | |
| 61 | if (args['--help']) { |
| 62 | return this.help() |
| 63 | } |
| 64 | |
| 65 | const formatEnvValue = (name: string, text?: string) => { |
| 66 | const value = process.env[name] |
| 67 | const line = `- ${name}${text ? ` ${text}` : ''}` |
| 68 | |
| 69 | if (value === undefined) { |
| 70 | return dim(line + ':') |
| 71 | } |
| 72 | return bold(line + `: \`${value}\``) |
| 73 | } |
| 74 | |
| 75 | let schemaPath |
| 76 | try { |
| 77 | const schemaResult = await getSchemaWithPath({ |
| 78 | schemaPath: createSchemaPathInput({ |
| 79 | schemaPathFromArgs: args['--schema'], |
| 80 | schemaPathFromConfig: config.schema, |
| 81 | baseDir, |
| 82 | }), |
| 83 | }) |
| 84 | schemaPath = link(schemaResult.schemaPath) |
| 85 | } catch (e) { |
| 86 | schemaPath = e.message |
| 87 | } |
| 88 | const rootCacheDir = link(await getRootCacheDir()) |
| 89 | |
| 90 | return `${underline('-- Prisma schema --')} |
| 91 | Path: ${schemaPath} |
| 92 | |
| 93 | ${underline('-- Local cache directory for engines files --')} |
| 94 | Path: ${rootCacheDir} |
| 95 | |
| 96 | ${underline('-- Environment variables --')} |
| 97 | When not set, the line is dimmed and no value is displayed. |
| 98 | When set, the line is bold and the value is inside the \`\` backticks. |
| 99 | |
| 100 | For general debugging |
| 101 | ${formatEnvValue('CI')} |
| 102 | ${formatEnvValue('DEBUG')} |
| 103 | ${formatEnvValue('NODE_ENV')} |
| 104 | ${formatEnvValue('RUST_LOG')} |
| 105 | ${formatEnvValue('RUST_BACKTRACE')} |
nothing calls this directly
no test coverage detected