Closed
Description
Before:
case "$x"
in
(0)
echo 'none!'
;;
(1)
echo 'it'"'"'s one!'
;;
(*)
echo 'something!'
;;
esac
After shfmt -p -s
:
#!/bin/sh
set -e -f -u -x
x="${1:-0}"
readonly x
case "$x" in
0)
echo 'none!'
;;
1)
echo 'it'"'"'s one!'
;;
*)
echo 'something!'
;;
esac
POSIX allows case
items to start with a parenthesis, and I prefer it, because it makes case
look more understandable, imo. I would like an option to either add them or at least not remove them.
(Also, I've noticed that shfmt
seems to add an empty line after case … in
, which looks like a bug.)
Metadata
Assignees
Labels
No labels
Activity