From d3292436378f4f8b374578aaa7a999b80ac384e3 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Fri, 8 Dec 2023 16:13:57 -0800 Subject: [PATCH] Edd .editorconfig for *.sh and format shell scripts --- .editorconfig | 3 +++ bat/update.sh | 12 +++++------- bat/verify.sh | 16 +++++++--------- 3 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..47ff004 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.sh] +indent_style = space +indent_size = 4 diff --git a/bat/update.sh b/bat/update.sh index 116d7f7..1c2e588 100755 --- a/bat/update.sh +++ b/bat/update.sh @@ -2,10 +2,9 @@ set -e -if [ $# -ne 1 ] -then - echo "Usage: $0 " - exit 1 +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 fi script_path=$(realpath "$0") @@ -23,8 +22,7 @@ cp assets/themes.bin "$script_dir" acknowledgements_file="$script_dir/acknowledgements.txt" cp LICENSE-MIT "$acknowledgements_file" -zlib-flate -uncompress < assets/acknowledgements.bin >> "$acknowledgements_file" -echo "$git_hash" > "$script_dir/bat.git-hash" +zlib-flate -uncompress >"$acknowledgements_file" +echo "$git_hash" >"$script_dir/bat.git-hash" echo "syntaxes/themes updated" - diff --git a/bat/verify.sh b/bat/verify.sh index 7d51332..533dad4 100755 --- a/bat/verify.sh +++ b/bat/verify.sh @@ -12,15 +12,13 @@ git clone https://github.com/sharkdp/bat.git "$clone_path" cd "$clone_path" git reset --hard "$git_hash" -for file in syntaxes.bin themes.bin -do - our_hash=$(sha256sum "$script_dir/$file" | cut -d " " -f1) - their_hash=$(sha256sum "$clone_path/assets/$file" | cut -d " " -f 1) - if [ "$our_hash" != "$their_hash" ] - then - echo "Unexpected hash for ${file}: should be ${their_hash}, is ${our_hash}" - exit 1 - fi +for file in syntaxes.bin themes.bin; do + our_hash=$(sha256sum "$script_dir/$file" | cut -d " " -f1) + their_hash=$(sha256sum "$clone_path/assets/$file" | cut -d " " -f 1) + if [ "$our_hash" != "$their_hash" ]; then + echo "Unexpected hash for ${file}: should be ${their_hash}, is ${our_hash}" + exit 1 + fi done echo "All hashes match"