fauust / pre-commit-shfmt

shell pre-commit hooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pre-commit-shfmt hook

This project will be archived and you should now use https://github.com/fauust/pre-commit-shell.

pre-commit

Single pre-commit hook which runs shfmt on shell script files (forked from https://github.com/pecigonzalo/pre-commit-shfmt).

Usage

.pre-commit-config.yaml example:

- repo: https://github.com/fauust/pre-commit-fmt
  rev: v1.1
  hooks:
    - id: shell-fmt
      args: ["-d", "-i", "2", "-ci"]

The shfmt tool must be installed separately.

Alternative using docker

For CI systems or if you don't want to install shfmt, you can use the original docker image:

- repo: local
  hooks:
    - id: docker-shell-shfmt
      name: Run shfmt with docker
      entry: mvdan/shfmt:latest -d -i 2 -ci
      language: docker_image
      types: [shell]

Enjoy the clean code!

About

shell pre-commit hooks


Languages

Language:Shell 100.0%