mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-12 01:58:50 +00:00
Update cheatsheets
This commit is contained in:
25
shfmt
Normal file
25
shfmt
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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}}`
|
||||
Reference in New Issue
Block a user