|
| 1 | +# |
| 2 | +# This source file is part of the EdgeDB open source project. |
| 3 | +# |
| 4 | +# Copyright 2022-present MagicStack Inc. and the EdgeDB authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +# |
| 18 | + |
| 19 | + |
| 20 | +import argparse |
| 21 | + |
| 22 | +from . import generator |
| 23 | + |
| 24 | + |
| 25 | +parser = argparse.ArgumentParser( |
| 26 | + description="Generate Python code for .edgeql files." |
| 27 | +) |
| 28 | +parser.add_argument("--dsn") |
| 29 | +parser.add_argument("--credentials_file", metavar="PATH") |
| 30 | +parser.add_argument("-I", "--instance", metavar="NAME") |
| 31 | +parser.add_argument("-H", "--host") |
| 32 | +parser.add_argument("-P", "--port") |
| 33 | +parser.add_argument("-d", "--database", metavar="NAME") |
| 34 | +parser.add_argument("-u", "--user") |
| 35 | +parser.add_argument("--password") |
| 36 | +parser.add_argument("--password-from-stdin", action="store_true") |
| 37 | +parser.add_argument("--tls-ca-file", metavar="PATH") |
| 38 | +parser.add_argument( |
| 39 | + "--tls-security", |
| 40 | + choices=["default", "strict", "no_host_verification", "insecure"], |
| 41 | +) |
| 42 | +parser.add_argument("--file", action="store_true") |
| 43 | +parser.add_argument( |
| 44 | + "--target", |
| 45 | + choices=["blocking", "async", "pydantic"], |
| 46 | + nargs="*", |
| 47 | + default=["async", "pydantic"], |
| 48 | +) |
| 49 | + |
| 50 | + |
| 51 | +def main(): |
| 52 | + args = parser.parse_args() |
| 53 | + generator.Generator(args).run() |
0 commit comments