https://github.com/tmknom/shfmt
Dockernized shfmt. This formats shell script.
https://github.com/tmknom/shfmt
docker docker-image dockerfile formatter shell-script
Last synced: 10 months ago
JSON representation
Dockernized shfmt. This formats shell script.
- Host: GitHub
- URL: https://github.com/tmknom/shfmt
- Owner: tmknom
- License: apache-2.0
- Created: 2018-09-24T10:01:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T15:42:57.000Z (over 6 years ago)
- Last Synced: 2024-11-04T14:42:57.216Z (about 1 year ago)
- Topics: docker, docker-image, dockerfile, formatter, shell-script
- Language: Makefile
- Homepage: https://github.com/mvdan/sh
- Size: 14.6 KB
- Stars: 29
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shfmt
[](https://circleci.com/gh/tmknom/shfmt)
[](https://hub.docker.com/r/tmknom/shfmt/builds/)
[](https://hub.docker.com/r/tmknom/shfmt/)
[](https://microbadger.com/images/tmknom/shfmt)
[](https://microbadger.com/images/tmknom/shfmt)
[](https://opensource.org/licenses/Apache-2.0)
Format shell script based on Docker.
This is [shfmt](https://github.com/mvdan/sh) wrapper.
## Requirements
- [Docker](https://www.docker.com/)
## Usage
### Format a file
```sh
docker run --rm -v $PWD:/work tmknom/shfmt foo.sh
```
### Format all .sh extension
Use `-w` to write result to file instead of stdout.
```sh
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](https://google.github.io/styleguide/shell.xml).
```sh
docker run --rm -v $PWD:/work tmknom/shfmt -i 2 -ci -w **/*.sh
```
### Help
For details, refer to [mvdan/sh](https://github.com/mvdan/sh).
```sh
docker run --rm -v $PWD:/work tmknom/shfmt
```
## Makefile targets
```text
build Build docker image
format Format code
help Show help
install Install requirements
lint Lint code
```
## Development
### Installation
```shell
git clone git@github.com:tmknom/shfmt.git
cd shfmt
make install
```
### Deployment
Automatically deployed by "[DockerHub Automated Build](https://docs.docker.com/docker-hub/builds/)" 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.