From cdef65ae530fe60f4baac65f4b3c44fee42435df Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 23 May 2020 21:36:17 +0100 Subject: [PATCH] Format shell scripts with shfmt --- bin/bootstrap-caskroom | 3 -- bin/bootstrap-homebrew | 3 -- bin/create-chrome-ssb | 15 +++++----- bin/docker-volume-backup | 26 ++++++++--------- bin/docker-volume-restore | 38 ++++++++++++------------ bin/emacs-gui-server | 11 ++++--- bin/emacsclient-wrapper | 2 +- bin/geoiptool | 9 +++--- bin/git-log-list-files | 2 +- bin/hr | 52 +++++++++++++++------------------ bin/linux-toggle-app | 16 +++++----- bin/logrotate-ex | 2 +- bin/rubocop-bundle-safe | 2 +- bin/smart-health-check | 35 +++++++++++++--------- bin/untilfail | 2 +- bitbar/brew-cask-upgrades.1h.sh | 6 ++-- bitbar/brew-upgrades.1h.sh | 10 +++---- install.sh | 30 +++++++++---------- scripts/install-emacs.sh | 28 +++++++++++++----- scripts/install-tmux.sh | 14 ++++----- scripts/install-zsh.sh | 6 ++-- zsh/aliases.zsh | 34 ++++++++++----------- zsh/docker.zsh | 2 +- zsh/golang.zsh | 2 +- zsh/macos.zsh | 14 ++++----- zsh/nodejs.zsh | 2 +- zsh/python.zsh | 2 +- zsh/ruby.zsh | 36 +++++++++++------------ zshenv | 15 ++++++---- zshrc | 11 +++---- 30 files changed, 219 insertions(+), 211 deletions(-) diff --git a/bin/bootstrap-caskroom b/bin/bootstrap-caskroom index 5eccd4b..107d0da 100755 --- a/bin/bootstrap-caskroom +++ b/bin/bootstrap-caskroom @@ -5,7 +5,6 @@ set -e PACKAGE_LIST_CMD="brew cask list" PACKAGE_INSTALL_CMD="brew cask install" - # # Package list # @@ -136,7 +135,6 @@ PERSONAL_PKGS=( yakyak ) - # # Main # @@ -155,7 +153,6 @@ main() { fi } - # # The rest... # diff --git a/bin/bootstrap-homebrew b/bin/bootstrap-homebrew index 258b174..a769b35 100755 --- a/bin/bootstrap-homebrew +++ b/bin/bootstrap-homebrew @@ -5,7 +5,6 @@ set -e PACKAGE_LIST_CMD="brew list" PACKAGE_INSTALL_CMD="brew install" - # # Package list # @@ -63,7 +62,6 @@ PERSONAL_PKGS=( "mkvtoolnix --with-qt" ) - # # Main # @@ -78,7 +76,6 @@ main() { fi } - # # The rest... # diff --git a/bin/create-chrome-ssb b/bin/create-chrome-ssb index 52dc92e..3396c36 100755 --- a/bin/create-chrome-ssb +++ b/bin/create-chrome-ssb @@ -15,7 +15,7 @@ icon="$3" if [ -z "$name" ] || [ -z "$url" ]; then echo 'usage: create-chrome-ssb "Google Music"' \ - '"https://play.google.com/music"' + '"https://play.google.com/music"' exit 1 fi @@ -31,11 +31,10 @@ if [ -d "$app_path" ]; then exit 1 fi - # Various paths used when creating the app. resource_dir="${app_path}/Contents/Resources" exec_dir="${app_path}/Contents/MacOS" -exec_file="${exec_dir}/${name//[[:space:]]}" +exec_file="${exec_dir}/${name//[[:space:]]/}" plist_file="${app_path}/Contents/Info.plist" app_support="\${HOME}/Library/Application Support" @@ -46,10 +45,10 @@ bundle_identifier="me.jimeh.chrome-ssb.${name}" mkdir -p "$resource_dir" "$exec_dir" # convert the icon and copy into Resources -if [ -f "$icon" ] ; then +if [ -f "$icon" ]; then sips -s format tiff "$icon" \ - --out "${resource_dir}/icon.tiff" \ - --resampleWidth 128 >& /dev/null + --out "${resource_dir}/icon.tiff" \ + --resampleWidth 128 >&/dev/null tiff2icns -noLarge "${resource_dir}/icon.tiff" >&/dev/null if [ -f "${resource_dir}/icon.tiff" ]; then @@ -58,7 +57,7 @@ if [ -f "$icon" ] ; then fi # Create the executable. -cat > "$exec_file" < "$exec_file" << EOF #!/bin/sh mkdir -p "${profile_dir}" exec "${chrome_path}" \\ @@ -70,7 +69,7 @@ EOF chmod +x "$exec_file" # Create the Info.plist. -cat > "$plist_file" < "$plist_file" << EOF diff --git a/bin/docker-volume-backup b/bin/docker-volume-backup index 817405b..61764d4 100755 --- a/bin/docker-volume-backup +++ b/bin/docker-volume-backup @@ -1,13 +1,13 @@ #! /usr/bin/env bash set -e -abs_dirname () { +abs_dirname() { local path="$1" local cwd cwd="$(pwd)" while [ -n "$path" ]; do - cd "${path%/*}" 2>/dev/null + cd "${path%/*}" 2> /dev/null local name="${path##*/}" path="$(resolve_link "$name" || true)" done @@ -16,16 +16,16 @@ abs_dirname () { cd "$cwd" } -abs_path () { +abs_path() { local path="$1" echo "$(cd "$(abs_dirname "$path")" && pwd)/$(basename "$path")" } -resolve_link () { +resolve_link() { $(type -p greadlink readlink | head -1) "$1" } -resolve_dest () { +resolve_dest() { local dest="$1" if [ -z "$dest" ]; then @@ -42,7 +42,7 @@ resolve_dest () { echo "$dest" } -resolve_dest_dir () { +resolve_dest_dir() { local dest="$1" local dir @@ -55,7 +55,7 @@ resolve_dest_dir () { echo "$dir" } -help () { +help() { echo "usage: docker-volume-backup []" echo "" echo "Backs up contents of a Docker volume to a gzipped tar archive." @@ -66,7 +66,7 @@ help () { echo " Defaults to: ./__