mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-10-28 12:59:51 +01:00
shfmt: add page (#10113)
Co-authored-by: CleanMachine1 <78213164+CleanMachine1@users.noreply.github.com> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
This commit is contained in:
parent
a9816916c6
commit
e95abcac23
1 changed files with 20 additions and 0 deletions
20
pages/common/shfmt.md
Normal file
20
pages/common/shfmt.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# shfmt
|
||||
|
||||
> Shell parser, formatter and interpreter.
|
||||
> More information: <https://pkg.go.dev/mvdan.cc/sh>.
|
||||
|
||||
- Print a formatted version of a shell script:
|
||||
|
||||
`shfmt {{path/to/file}}`
|
||||
|
||||
- List unformatted files:
|
||||
|
||||
`shfmt --list {{path/to/directory}}`
|
||||
|
||||
- Write the result to the file instead of printing it to the terminal:
|
||||
|
||||
`shfmt --write {{path/to/file}}`
|
||||
|
||||
- Simplify the code, removing redundant pieces of syntax (i.e. removing "$" from vars in expressions):
|
||||
|
||||
`shfmt --simplify {{path/to/file}}`
|
Loading…
Reference in a new issue