# Path: rebasehelper/cli.py
# class CLI:
#     """ Class for processing data from commandline """
# 
#     @staticmethod
#     def build_parser(available_choices_only=False):
#         parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION,
#                                       formatter_class=CustomHelpFormatter)
# 
#         group = None
#         current_group = 0
#         for option in traverse_options(OPTIONS + plugin_manager.get_options()):
#             available_choices = option.pop("available_choices", option.get("choices"))
#             if available_choices_only:
#                 option["choices"] = available_choices
# 
#             option_kwargs = dict(option)
#             for key in ("group", "default", "name"):
#                 if key in option_kwargs:
#                     del option_kwargs[key]
# 
#             if "group" in option:
#                 if not group or current_group != option["group"]:
#                     current_group = option["group"]
#                     group = parser.add_mutually_exclusive_group()
#                 actions_container = group
#             else:
#                 actions_container = parser
# 
#             # default is set to SUPPRESS to prevent arguments which were not specified on command line from being
#             # added to namespace. This allows rebase-helper to determine which arguments are used with their
#             # default value. This is later used for merging CLI arguments with config.
#             actions_container.add_argument(*option["name"], action=CustomAction, default=argparse.SUPPRESS,
#                                            actual_default=option.get("default"), **option_kwargs)
# 
#         return parser
# 
#     def __init__(self, args=None):
#         """parse arguments"""
#         if args is None:
#             args = sys.argv[1:]
#         # sanitize builder options to prevent ArgumentParser from processing them
#         for opt in ['--builder-options', '--srpm-builder-options']:
#             try:
#                 i = args.index(opt)
#                 args[i:i+2] = ['='.join(args[i:i+2])]
#             except ValueError:
#                 continue
#         self.parser = CLI.build_parser(available_choices_only=True)
#         self.args = self.parser.parse_args(args)
# 
#     def __getattr__(self, name):
#         try:
#             return getattr(self.args, name)
#         except AttributeError:
#             return object.__getattribute__(self, name)


from rebasehelper.cli import CLI
            'non_interactive': True,
            'builds_nowait': True,
            'build_tasks': ['123456', '654321'],
            'results_dir': '/tmp/rebase-helper',
            'srpm_builder_options': '\"-r fedora-26-x86_64\"',
            'builder_options': '\"-v\"',
            'changelog_entry': 'Update to %{version}',
            'sources': 'test-1.0.3.tar.gz',
            'version': False,
            'versioneer': None,
            'disable_inapplicable_patches': False,
            'get_old_build_from_koji': False,
            'color': 'auto',
        }
        arguments = [
            '--verbose',
            '--srpm-buildtool', 'mock',
            '--buildtool', 'rpmbuild',
            '--outputtool', 'json',
            '--keep-workspace',
            '--not-download-sources',
            '--non-interactive',
            '--builds-nowait',
            '--build-tasks', '123456,654321',
            '--results-dir', '/tmp/rebase-helper',
            '--srpm-builder-options=\"-r fedora-26-x86_64\"',
            '--builder-options=\"-v\"',
            '--changelog-entry', 'Update to %{version}',
            'test-1.0.3.tar.gz',
        ]

# Path: rebasehelper/cli.py
# class CLI:
#     """ Class for processing data from commandline """
# 
#     @staticmethod
#     def build_parser(available_choices_only=False):
#         parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION,
#                                       formatter_class=CustomHelpFormatter)
# 
#         group = None
#         current_group = 0
#         for option in traverse_options(OPTIONS + plugin_manager.get_options()):
#             available_choices = option.pop("available_choices", option.get("choices"))
#             if available_choices_only:
#                 option["choices"] = available_choices
# 
#             option_kwargs = dict(option)
#             for key in ("group", "default", "name"):
#                 if key in option_kwargs:
#                     del option_kwargs[key]
# 
#             if "group" in option:
#                 if not group or current_group != option["group"]:
#                     current_group = option["group"]
#                     group = parser.add_mutually_exclusive_group()
#                 actions_container = group
#             else:
#                 actions_container = parser
# 
#             # default is set to SUPPRESS to prevent arguments which were not specified on command line from being
#             # added to namespace. This allows rebase-helper to determine which arguments are used with their
#             # default value. This is later used for merging CLI arguments with config.
#             actions_container.add_argument(*option["name"], action=CustomAction, default=argparse.SUPPRESS,
#                                            actual_default=option.get("default"), **option_kwargs)
# 
#         return parser
# 
#     def __init__(self, args=None):
#         """parse arguments"""
#         if args is None:
#             args = sys.argv[1:]
#         # sanitize builder options to prevent ArgumentParser from processing them
#         for opt in ['--builder-options', '--srpm-builder-options']:
#             try:
#                 i = args.index(opt)
#                 args[i:i+2] = ['='.join(args[i:i+2])]
#             except ValueError:
#                 continue
#         self.parser = CLI.build_parser(available_choices_only=True)
#         self.args = self.parser.parse_args(args)
# 
#     def __getattr__(self, name):
#         try:
#             return getattr(self.args, name)
#         except AttributeError:
#             return object.__getattribute__(self, name)


# Path: rebasehelper/tests/test_cli.py
from rebasehelper.cli import CLI

            'non_interactive': True,
            'builds_nowait': True,
            'build_tasks': ['123456', '654321'],
            'results_dir': '/tmp/rebase-helper',
            'srpm_builder_options': '\"-r fedora-26-x86_64\"',
            'builder_options': '\"-v\"',
            'changelog_entry': 'Update to %{version}',
            'sources': 'test-1.0.3.tar.gz',
            'version': False,
            'versioneer': None,
            'disable_inapplicable_patches': False,
            'get_old_build_from_koji': False,
            'color': 'auto',
        }
        arguments = [
            '--verbose',
            '--srpm-buildtool', 'mock',
            '--buildtool', 'rpmbuild',
            '--outputtool', 'json',
            '--keep-workspace',
            '--not-download-sources',
            '--non-interactive',
            '--builds-nowait',
            '--build-tasks', '123456,654321',
            '--results-dir', '/tmp/rebase-helper',
            '--srpm-builder-options=\"-r fedora-26-x86_64\"',
            '--builder-options=\"-v\"',
            '--changelog-entry', 'Update to %{version}',
            'test-1.0.3.tar.gz',
        ]

        cli = CLI(arguments)