docs: def install(**kwargs):
      """Install the pre-commit hook."""
      force = kwargs.get('force')
      preserve_legacy = kwargs.get('preserve_legacy')
  
      colorama.init(strip=kwargs.get('no_color'))
  
      stdout = subprocess.check_output('which therapist', shell=True)
      therapist_bin = stdout.decode('utf-8').split()[0]
  
      git_dir = current_git_dir()
  
      if git_dir is None:
          output(NOT_GIT_REPO_MSG)
          exit(1)
  
      hook_options = {
          'fix': '--fix' if kwargs.get('fix') else '',
          'stage_modified_files': '' if kwargs.get('no_stage_modified_files') else '--stage-modified-files',
          'therapist_bin': therapist_bin,
      }
  
      srchook_path = os.path.join(BASE_DIR, 'hooks', 'pre-commit-template')
      with open(srchook_path, 'r') as f:
          srchook = f.read()
      srchook_hash = hash_hook(srchook_path, hook_options)
  
      dsthook_path = os.path.join(git_dir, 'hooks', 'pre-commit')
  
      if os.path.isfile(dsthook_path):
          dsthook_hash = identify_hook(dsthook_path)
          if dsthook_hash:
              if dsthook_hash == srchook_hash:
                  output(HOOK_ALREADY_INSTALLED_MSG)
                  exit(0)
          else:
              if not force and not preserve_legacy:
                  print(EXISTING_HOOK_MSG)
                  preserve_legacy = click.confirm(CONFIRM_PRESERVE_LEGACY_HOOK_MSG, default=True)
  
              if preserve_legacy:
                  output(COPYING_HOOK_MSG, end='')
                  shutil.copy2(dsthook_path, '{}.legacy'.format(dsthook_path))
                  output(DONE_COPYING_HOOK_MSG)
              elif not force:
                  if not click.confirm(CONFIRM_REPLACE_HOOK_MSG, default=False):
                      output(INSTALL_ABORTED_MSG)
                      exit(1)
  
      output(INSTALLING_HOOK_MSG, end='')
      with open(dsthook_path, 'w+') as f:
          srchook = srchook.replace('%hash%', srchook_hash)
          for k, v in iteritems(hook_options):
              srchook = srchook.replace('%{}%'.format(k), v)
          f.write(srchook)
      os.chmod(dsthook_path, 0o775)
      output(DONE_INSTALLING_HOOK_MSG)