args

Support added in lefthook version 2.0.5

Sometimes you want to pass arguments to the scripts or be able to overwrite arguments to the commands in lefthook-local.yml. For this you can use args option which will simply be appended to the command. You can use the same templates as in run.

Arguments passed by Git will be omitted if you specify args in the config. Providing no args or providing args: "{0}" works the same way.

See run for supported templates.

Example

# lefthook.yml

pre-commit:
  jobs:
    - script: check-python-files.sh
      runner: bash
      args: "{staged_files}"
      glob: "*.py"

    - run: yarn lint
      args: "{staged_files}"
      glob:
        - "*.ts"
        - "*.js"