From df0dbe2fbca4cae3b8274cc4ea9c5c2658a9edfd Mon Sep 17 00:00:00 2001 From: adithyasunil26 Date: Sun, 10 Jan 2021 13:37:24 +0400 Subject: [PATCH] Made README more concise and added examples --- shfmt/README.md | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/shfmt/README.md b/shfmt/README.md index 4756e26..40eef2d 100644 --- a/shfmt/README.md +++ b/shfmt/README.md @@ -17,9 +17,9 @@ Usage: `shfmt ` Note: If given path is directory, all shell scripts in the directory will be used. -### Flags: +### Frequently used flags: -````txt +```txt -version Show version and exit. @@ -35,42 +35,22 @@ used. -s Simplify the code. --mn - Minify the code to reduce its size (implies -s). - --ln - Language variant to parse (bash/posix/mksh/bats, default "bash"). - --p - Shorthand for -ln=posix. - --filename - Provide a name for the standard input file. - --i - Indent: 0 for tabs (default), >0 for number of spaces. - --bn - Binary ops like && and | may start a line. - --ci - Switch cases will be indented. +-f + Recursively find all shell files and print the paths. +``` --sr - Redirect operators will be followed by a space. +### Examples --kp - Keep column alignment paddings. +To list files being formatted and write directly to file --fn - Function opening braces are placed on a separate line. +```bash +shfmt -l -w +``` --f - Recursively find all shell files and print the paths. +To show differences between shfmt formatting and original file formatting --tojson - Print syntax tree to stdout as a typed JSON. -```txt +```bash +shfmt -d +``` See https://github.com/mvdan/sh for more info. -```` -- 2.25.1