Format code using shfmt

This commit is contained in:
BarbUk 2024-02-16 08:27:57 +01:00
parent 8935c2c131
commit 5c3781ceb6
No known key found for this signature in database
GPG Key ID: B6D01F84A7519939

13
snippy
View File

@ -85,7 +85,7 @@ snippet=
# @param string - string with bash(down) syntax (usually surrounded by ' quotes instead of ")
bashdown() {
while IFS= read -r line; do
line="$(eval "printf -- \"$( printf "%s" "$line" | sed 's/"/\\"/g' )\"")";
line="$(eval "printf -- \"$(printf "%s" "$line" | sed 's/"/\\"/g')\"")"
echo -e "$line"
done
}
@ -254,10 +254,10 @@ cli() {
list() {
local type="${1:-f}"
find -L . -type "$type" \
| grep -vE '^\.$|\.git|\.gitconfig|\.gitkeep|\.gitignore' \
| sed -e 's!\.\/!!' \
| sort
find -L . -type "$type" |
grep -vE '^\.$|\.git|\.gitconfig|\.gitkeep|\.gitignore' |
sed -e 's!\.\/!!' |
sort
}
add() {
@ -338,7 +338,8 @@ run() {
printf "%s" "$content" >"$tmpfile"
fi
else [[ ${snippet} =~ ^$ ]]
else
[[ ${snippet} =~ ^$ ]]
${snippet##*$} 2>/dev/null >"$tmpfile" # execute as bashcommand
fi