# 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 extract_pk(nas, field_name):
#     return {field_name: getattr(nas, field_name)}


from invtool.lib.options import build_extractor, extract_pk
    # Required has no affect.
    def add_delete_pk_argument(parser, **kwargs):
        parser.add_argument(
            '--{0}'.format(display_name), default=None,
            type=int, dest=field_name, help="Delete the Key Value pair with "
            "the corresponding database primary key.".format(dtype),
            required=True
        )
        return parser

    def _extract_pk(nas):
        return extract_pk(nas, field_name)

    def test_data():
        # kv_pk will need to be evaluated in at test time
        return display_name, '{{ kv_pk }}'

    return add_delete_pk_argument, _extract_pk, test_data


def key_argument(field_name):
    def add_key_argument(parser, required=True):
        parser.add_argument(
            '--key/-k', default=None, type=str, dest='key',
            help="The key.", required=required
        )

    def test_data():
        return 'key', 'testkey'


# 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 extract_pk(nas, field_name):
#     return {field_name: getattr(nas, field_name)}


# Path: invtool/lib/kv_options.py
from invtool.lib.options import build_extractor, extract_pk

    # Required has no affect.
    def add_delete_pk_argument(parser, **kwargs):
        parser.add_argument(
            '--{0}'.format(display_name), default=None,
            type=int, dest=field_name, help="Delete the Key Value pair with "
            "the corresponding database primary key.".format(dtype),
            required=True
        )
        return parser

    def _extract_pk(nas):
        return extract_pk(nas, field_name)

    def test_data():
        # kv_pk will need to be evaluated in at test time
        return display_name, '{{ kv_pk }}'

    return add_delete_pk_argument, _extract_pk, test_data


def key_argument(field_name):
    def add_key_argument(parser, required=True):
        parser.add_argument(
            '--key/-k', default=None, type=str, dest='key',
            help="The key.", required=required
        )

    def test_data():
        return 'key', 'testkey'


    return add_key_argument, build_extractor(field_name, 'key'), test_data