# 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/constants.py
# CONFIG_PATH: str = '$XDG_CONFIG_HOME'
# 
# CONFIG_FILENAME: str = 'rebase-helper.cfg'
# 
# ENCODING: str = locale.getpreferredencoding()


import os
import sys
from argparse import SUPPRESS
from typing import List
from rebasehelper.cli import CLI
from rebasehelper.constants import CONFIG_PATH, CONFIG_FILENAME, ENCODING
    def generate(cls):
        result = cls.DESCRIPTION + ['']
        parser = CLI.build_parser()
        result.append('[general]')
        for action in parser._get_optional_actions():  # pylint: disable=protected-access
            if action.help is SUPPRESS:
                continue
            fmt = parser._get_formatter()  # pylint: disable=protected-access
            opts = action.option_strings
            if len(opts) > 1:
                opts.pop(0)
            name = opts[0].lstrip('-')
            if name in cls.BLACKLIST:
                continue
            value = getattr(action, 'actual_default', None)
            if isinstance(value, list):
                value = ','.join(value)
            args = fmt._format_args(action, action.dest.upper())  # pylint: disable=protected-access
            result.append('')
            result.append('# {}'.format(fmt._expand_help(action)))  # pylint: disable=protected-access
            if args:
                result.append('# synopsis: {} = {}'.format(name, args))
            result.append('{} = {}'.format(name, value if value is not None else ''))
        return '\n'.join(result)


def main():
    if len(sys.argv) != 2:
        return 1
    s = SampleConfig.generate()

# 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/constants.py
# CONFIG_PATH: str = '$XDG_CONFIG_HOME'
# 
# CONFIG_FILENAME: str = 'rebase-helper.cfg'
# 
# ENCODING: str = locale.getpreferredencoding()


# Path: rebasehelper/sample_config.py
import os
import sys
from argparse import SUPPRESS
from typing import List
from rebasehelper.cli import CLI
from rebasehelper.constants import CONFIG_PATH, CONFIG_FILENAME, ENCODING

    def generate(cls):
        result = cls.DESCRIPTION + ['']
        parser = CLI.build_parser()
        result.append('[general]')
        for action in parser._get_optional_actions():  # pylint: disable=protected-access
            if action.help is SUPPRESS:
                continue
            fmt = parser._get_formatter()  # pylint: disable=protected-access
            opts = action.option_strings
            if len(opts) > 1:
                opts.pop(0)
            name = opts[0].lstrip('-')
            if name in cls.BLACKLIST:
                continue
            value = getattr(action, 'actual_default', None)
            if isinstance(value, list):
                value = ','.join(value)
            args = fmt._format_args(action, action.dest.upper())  # pylint: disable=protected-access
            result.append('')
            result.append('# {}'.format(fmt._expand_help(action)))  # pylint: disable=protected-access
            if args:
                result.append('# synopsis: {} = {}'.format(name, args))
            result.append('{} = {}'.format(name, value if value is not None else ''))
        return '\n'.join(result)


def main():
    if len(sys.argv) != 2:
        return 1
    s = SampleConfig.generate()

    with open(sys.argv[1], 'w', encoding=ENCODING) as f: