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