def select_docker_file(files):
    """Ask user which docker file to use and return a PurePath object."""
    num = 0
    n = len(files)
    if n > 1:
        print('Available docker files:')
        for i, f in enumerate(files):
            print(i + 1, f.name)
        while True:
            end = len(files)
            input_str = input('which docker file to use? [1-{}] '.format(end))
            try:
                num = int(input_str) - 1
                if num < 0 or num >= end:
                    raise ValueError
                break
            except (TypeError, ValueError):
                print('Invalid input: {}. Please choose from [1-{}]'.format
                    (input_str, end))
                continue
    return files[num]
