# Path: invtool/lib/options.py
# def build_extractor(field_name, nas_name):
#     def extractor(nas):
#         if not getattr(nas, nas_name):
#             return {}
#         data = {field_name: getattr(nas, nas_name)}
#         return data
#     return extractor
# 
# def general_argument(field_name, help, type=lambda x: x, test_data=None):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     if test_data is None:
#         def test_data_fun():
#             return field_name, TEST_STR()  # Reuse this test data
#     else:
#         test_data_fun = test_data
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data_fun
# 
# Path: invtool/tests/test_data.py
# TEST_STR = lambda: random_str()


from invtool.lib.options import build_extractor, general_argument
from invtool.tests.test_data import TEST_STR

def foreign_key_argument(field_name, help):
    real_fname = field_name.replace('-', '_')

    def add_srt_arg(parser, **kwargs):
        parser.add_argument(
            '--{0}-pk'.format(field_name), default="", type=str,
            dest=real_fname, required=False, help=help
        )

    def test_data():
        return '', ''

    return add_srt_arg, build_extractor(real_fname, real_fname), test_data


def hostname_argument(field_name, help):
    return general_argument(field_name, help)


def new_hostname_argument():
    def add_srt_arg(parser, **kwargs):
        parser.add_argument(
            '--new-hostname', default="", type=str,
            dest='hostname', required=False, help='If you are changing the '
            'hostname of an existing system specify it with --hostname and '
            'use this option to assign a new hostname'
        )

    def test_data():

# Path: invtool/lib/options.py
# def build_extractor(field_name, nas_name):
#     def extractor(nas):
#         if not getattr(nas, nas_name):
#             return {}
#         data = {field_name: getattr(nas, nas_name)}
#         return data
#     return extractor
# 
# def general_argument(field_name, help, type=lambda x: x, test_data=None):
#     real_fname = field_name.replace('-', '_')
# 
#     def add_srt_arg(parser, **kwargs):
#         parser.add_argument(
#             '--{0}'.format(field_name), default="", type=str,
#             dest=real_fname, required=False, help=help
#         )
# 
#     if test_data is None:
#         def test_data_fun():
#             return field_name, TEST_STR()  # Reuse this test data
#     else:
#         test_data_fun = test_data
# 
#     return add_srt_arg, build_extractor(real_fname, real_fname), test_data_fun
# 
# Path: invtool/tests/test_data.py
# TEST_STR = lambda: random_str()


# Path: invtool/lib/system_options.py
from invtool.lib.options import build_extractor, general_argument
from invtool.tests.test_data import TEST_STR


def foreign_key_argument(field_name, help):
    real_fname = field_name.replace('-', '_')

    def add_srt_arg(parser, **kwargs):
        parser.add_argument(
            '--{0}-pk'.format(field_name), default="", type=str,
            dest=real_fname, required=False, help=help
        )

    def test_data():
        return '', ''

    return add_srt_arg, build_extractor(real_fname, real_fname), test_data


def hostname_argument(field_name, help):
    return general_argument(field_name, help)


def new_hostname_argument():
    def add_srt_arg(parser, **kwargs):
        parser.add_argument(
            '--new-hostname', default="", type=str,
            dest='hostname', required=False, help='If you are changing the '
            'hostname of an existing system specify it with --hostname and '
            'use this option to assign a new hostname'
        )

    def test_data():

        return 'new-hostname', TEST_STR()