sh - 一个shell解析器和格式化程序

网友投稿 779 2022-10-21

sh - 一个shell解析器和格式化程序

sh - 一个shell解析器和格式化程序

sh

A shell parser and formatter. Supports POSIX Shell and Bash.

For a quick overview, see the examples.

shfmt

go get -u github.com/mvdan/sh/cmd/shfmt

shfmt formats shell programs. It can use tabs or any number of spaces to indent. See canonical.sh for a quick look at its style.

You can feed it standard input, any number of files or any number of directories to recurse into. When recursing, it will operate on .sh and .bash files and ignore files starting with a period. It will also operate on files with no extension and a shell shebang.

shfmt -l -w script.sh

Use -i N to indent with a number of spaces instead of tabs.

Fuzzing

This project makes use of go-fuzz to find crashes and hangs in both the parser and the printer. To get started, run:

git checkout fuzz./fuzz

Related projects

format-shell - Atom plugin for shfmt

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Feign如何解决服务之间调用传递token
下一篇:构建并运行go程序的单个实例
相关文章

 发表评论

暂时没有评论,来抢沙发吧~