Quoting Markus Armbruster (2018-02-11 03:35:47)
> argparse is nicer to use than getopt, and gives us --help almost for
> free.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  scripts/qapi-gen.py    | 48 ++++++++++++++++++++++++++++++------------------
>  scripts/qapi/common.py | 43 -------------------------------------------
>  2 files changed, 30 insertions(+), 61 deletions(-)
> 
> diff --git a/scripts/qapi-gen.py b/scripts/qapi-gen.py
> index 2100ca1145..e5be484e3e 100755
> --- a/scripts/qapi-gen.py
> +++ b/scripts/qapi-gen.py
> @@ -4,8 +4,11 @@
>  # This work is licensed under the terms of the GNU GPL, version 2 or later.
>  # See the COPYING file in the top-level directory.
> 
> +from __future__ import print_function
> +import argparse
> +import re
>  import sys
> -from qapi.common import parse_command_line, QAPISchema
> +from qapi.common import QAPISchema
>  from qapi.types import gen_types
>  from qapi.visit import gen_visit
>  from qapi.commands import gen_commands
> @@ -15,26 +18,35 @@ from qapi.doc import gen_doc
> 
> 
>  def main(argv):
> -    (input_file, output_dir, prefix, opts) = \
> -        parse_command_line('bu', ['builtins', 'unmask-non-abi-names'])
> +    parser = argparse.ArgumentParser(
> +        description='Generate code from a QAPI schema')
> +    parser.add_argument('-b', '--builtins', action='store_true',
> +                        help="generate code for built-in types")
> +    parser.add_argument('-o', '--output_dir', action='store', default='',

Was the change from --output-dir to --output_dir intentional? The former
seems more consistent.


Reply via email to