from typing import List
from pathlib import Path


def do_single_check(command: str, relevant_files: List[Path],
                    command_check_mapping) -> bool:
    """Do a single check requested by a command."""
    check = dict(command_check_mapping)[command]
    if command == 'format':
        success = check(relevant_files, False)
    else:
        success = check(relevant_files)
    if not success:
        print('ERROR: %s failed, see errors above.' % check.__name__)

    return success