基于可执行文件的预提交挂钩(不是 git 回购)

Pre-commit hook based on an executable (not git repo)

我想要 运行 来自 pip 的可执行文件,它不能作为 git 存储库使用。文档似乎假定您想要 运行 的任何内容都来自 git 存储库:https://pre-commit.com/#plugins。我如何 运行 任意 shell 命令作为预提交挂钩?

预提交允许对回购部分使用 local 哨兵。下面的示例配置在系统上安装时运行黑色:

repos:
-   repo: local
    hooks:
    - id: black
      name: black
      language: system
      entry: black
      types: [python]