shfmt icon indicating copy to clipboard operation
shfmt copied to clipboard

Dockernized shfmt. This formats shell script.

shfmt

CircleCI Docker Build Status Docker Automated build MicroBadger Size MicroBadger Layers License

Format shell script based on Docker.

This is shfmt wrapper.

Requirements

Usage

Format a file

docker run --rm -v $PWD:/work tmknom/shfmt foo.sh

Format all .sh extension

Use -w to write result to file instead of stdout.

docker run --rm -v $PWD:/work tmknom/shfmt -w **/*.sh

Format Google's Shell Style Guide

Use -i N to indent with a number of spaces instead of tabs. Get the formatting appropriate for Google's Shell Style Guide.

docker run --rm -v $PWD:/work tmknom/shfmt -i 2 -ci -w **/*.sh

Help

For details, refer to mvdan/sh.

docker run --rm -v $PWD:/work tmknom/shfmt

Makefile targets

build                          Build docker image
format                         Format code
help                           Show help
install                        Install requirements
lint                           Lint code

Development

Installation

git clone [email protected]:tmknom/shfmt.git
cd shfmt
make install

Deployment

Automatically deployed by "DockerHub Automated Build" after merge.

Deployment Pipeline

  1. GitHub - Version Control System
  2. CircleCI - Continuous Integration
  3. Docker Hub - Docker Registry
  4. MicroBadger - Docker Inspection

License

Apache 2 Licensed. See LICENSE for full details.