(argv: string[], config: PrismaConfigInternal, baseDir: string)
| 116 | `) |
| 117 | |
| 118 | public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> { |
| 119 | const args = arg( |
| 120 | argv, |
| 121 | { |
| 122 | '--help': Boolean, |
| 123 | '-h': '--help', |
| 124 | '--output': String, |
| 125 | '-o': '--output', |
| 126 | // From |
| 127 | '--from-empty': Boolean, |
| 128 | '--from-config-datasource': Boolean, |
| 129 | '--from-schema': String, |
| 130 | '--from-migrations': String, |
| 131 | // To |
| 132 | '--to-empty': Boolean, |
| 133 | '--to-config-datasource': Boolean, |
| 134 | '--to-schema': String, |
| 135 | '--to-migrations': String, |
| 136 | // Others |
| 137 | '--script': Boolean, |
| 138 | '--exit-code': Boolean, |
| 139 | '--telemetry-information': String, |
| 140 | '--config': String, |
| 141 | // Removed, but parsed to show help error |
| 142 | '--from-url': String, |
| 143 | '--to-url': String, |
| 144 | '--from-schema-datasource': String, |
| 145 | '--to-schema-datasource': String, |
| 146 | '--from-schema-datamodel': String, |
| 147 | '--to-schema-datamodel': String, |
| 148 | '--from-local-d1': Boolean, |
| 149 | '--to-local-d1': Boolean, |
| 150 | }, |
| 151 | false, |
| 152 | ) |
| 153 | |
| 154 | if (isError(args)) { |
| 155 | return this.help(args.message) |
| 156 | } |
| 157 | |
| 158 | if (args['--help']) { |
| 159 | return this.help() |
| 160 | } |
| 161 | |
| 162 | const removedTargetParameterHint = Object.keys(args) |
| 163 | .map(getRemovedTargetParameterHint) |
| 164 | .find((msg) => msg !== undefined) |
| 165 | if (removedTargetParameterHint) { |
| 166 | return this.help(removedTargetParameterHint) |
| 167 | } |
| 168 | |
| 169 | const numberOfFromParameterProvided = |
| 170 | Number(Boolean(args['--from-empty'])) + |
| 171 | Number(Boolean(args['--from-config-datasource'])) + |
| 172 | Number(Boolean(args['--from-schema'])) + |
| 173 | Number(Boolean(args['--from-migrations'])) |
| 174 | |
| 175 | const numberOfToParameterProvided = |
nothing calls this directly
no test coverage detected