Hi!
To avoid unnecessary diff modifications, reduce potential accidents, and help with sortability in some cases, I've been using the following pattern on multi-line lists in commands:
#!/bin/sh
cmd_list \
aa \
bb \
cc \
# EOL
cmd_a \
| cmd_b \
| cmd_c \
| cmd_d \
# EOC
other
But running for example shfmt -i=2 -bn, disarms this pattern into:
#!/bin/sh
cmd_list \
aa \
bb \
cc
# EOL
cmd_a \
| cmd_b \
| cmd_c \
| cmd_d
# EOC
other
This pattern makes it so that adding, modifying or removing lines changes the minimal amount as possible (except if you need to insert something before cmd_a).
Hi!
To avoid unnecessary diff modifications, reduce potential accidents, and help with sortability in some cases, I've been using the following pattern on multi-line lists in commands:
But running for example
shfmt -i=2 -bn, disarms this pattern into:This pattern makes it so that adding, modifying or removing lines changes the minimal amount as possible (except if you need to insert something before
cmd_a).