# 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


def update_pk_argument(field_name, dtype):
    display_name = field_name.replace('_', '-')

    def add_update_pk_argument(parser, **kwargs):
        parser.add_argument(
            '--{0}'.format(display_name), required=True,
            default=None, type=int, dest=field_name, help="The database id of "
            "the {0} KV being updated.".format(dtype)
        )
        return parser

    def _extract_pk(nas):

# 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



def update_pk_argument(field_name, dtype):
    display_name = field_name.replace('_', '-')

    def add_update_pk_argument(parser, **kwargs):
        parser.add_argument(
            '--{0}'.format(display_name), required=True,
            default=None, type=int, dest=field_name, help="The database id of "
            "the {0} KV being updated.".format(dtype)
        )
        return parser

    def _extract_pk(nas):

        return extract_pk(nas, field_name)