format updates for shfmt README.md
[webi-installers/.git] / shfmt / README.md
1 ---
2 title: shfmt
3 homepage: https://github.com/mvdan/sh
4 tagline: |
5   shfmt: Format shell programs
6 ---
7
8 To update or switch versions, run `webi shfmt@stable` or `webi shfmt@beta`, etc.
9
10 ## Cheat Sheet
11
12 > shfmt is a shell parser, formatter and interpretter that supports POSIX Shell,
13 > Bash and mksh.
14
15 Usage: `shfmt <flags> <filepath>`
16
17 Note: If given path is directory, all shell scripts in the directory will be
18 used.
19
20 ### Flags:
21
22 ````txt
23 -version
24         Show version and exit.
25
26 -l
27         List files whose formatting differs from shfmt's.
28
29 -w
30         Write result to file instead of stdout.
31
32 -d
33         Error with a diff when the formatting differs.
34
35 -s
36         Simplify the code.
37
38 -mn
39         Minify the code to reduce its size (implies -s).
40
41 -ln <str>
42         Language variant to parse (bash/posix/mksh/bats, default "bash").
43
44 -p
45         Shorthand for -ln=posix.
46
47 -filename <str>
48         Provide a name for the standard input file.
49
50 -i <uint>
51         Indent: 0 for tabs (default), >0 for number of spaces.
52
53 -bn
54         Binary ops like && and | may start a line.
55
56 -ci
57         Switch cases will be indented.
58
59 -sr
60         Redirect operators will be followed by a space.
61
62 -kp
63         Keep column alignment paddings.
64
65 -fn
66         Function opening braces are placed on a separate line.
67
68 -f
69         Recursively find all shell files and print the paths.
70
71 -tojson
72         Print syntax tree to stdout as a typed JSON.
73 ```txt
74
75 See https://github.com/mvdan/sh for more info.
76 ````