run shfmt on scripts

shfmt -f . | xargs -E'\n' shfmt -w -i 4 -s
This commit is contained in:
Christian Höltje 2018-08-22 10:47:48 -04:00
parent 302a61e5d4
commit c6a73eba6b
5 changed files with 49 additions and 49 deletions

30
citest
View file

@ -5,26 +5,26 @@ set -euo pipefail
cd "$(dirname "$0")"
bash_scripts=(
yank.tmux
scripts/*.sh
yank.tmux
scripts/*.sh
)
set -x
docker run \
--rm \
--volume="${PWD}:/mnt:ro" \
--workdir="/mnt" \
bash:latest \
bash -Dn "${bash_scripts[@]}"
--rm \
--volume="${PWD}:/mnt:ro" \
--workdir="/mnt" \
bash:latest \
bash -Dn "${bash_scripts[@]}"
docker run \
--rm \
--volume="${PWD}:/mnt:ro" \
--workdir="/mnt" \
koalaman/shellcheck:stable \
--shell=bash \
--external-sources \
--color=always \
"${bash_scripts[@]}"
--rm \
--volume="${PWD}:/mnt:ro" \
--workdir="/mnt" \
koalaman/shellcheck:stable \
--shell=bash \
--external-sources \
--color=always \
"${bash_scripts[@]}"
# EOF

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HELPERS_DIR="$CURRENT_DIR"
TMUX_COPY_MODE=""
@ -19,7 +19,7 @@
add_sleep_for_remote_shells() {
local pane_command
pane_command="$(tmux display-message -p '#{pane_current_command}')"
if [[ "$pane_command" =~ (ssh|mosh) ]]; then
if [[ $pane_command =~ (ssh|mosh) ]]; then
sleep "$REMOTE_SHELL_WAIT_TIME"
fi
}
@ -51,23 +51,23 @@
# works when command spans accross multiple lines
end_of_line_in_copy_mode() {
if tmux_is_at_least 2.4; then
tmux send -X -N 150 'cursor-down' # 'down' key. 'vi' mode is faster so we're
tmux send -X -N 150 'cursor-down' # 'down' key. 'vi' mode is faster so we're
# jumping more lines than emacs.
tmux send -X 'end-of-line' # End of line (just in case we are already at the last line).
tmux send -X 'previous-word' # Beginning of the previous word.
tmux send -X 'next-word-end' # End of next word.
tmux send -X 'end-of-line' # End of line (just in case we are already at the last line).
tmux send -X 'previous-word' # Beginning of the previous word.
tmux send -X 'next-word-end' # End of next word.
elif [ "$TMUX_COPY_MODE" == "vi" ]; then
# vi copy mode
# This sequence of keys consistently selects multiple lines
tmux send-key '150' # Go to the bottom of scrollback buffer by using
tmux send-key 'j' # 'down' key. 'vi' mode is faster so we're
tmux send-key '150' # Go to the bottom of scrollback buffer by using
tmux send-key 'j' # 'down' key. 'vi' mode is faster so we're
# jumping more lines than emacs.
tmux send-key '$' # End of line (just in case we are already at the last line).
tmux send-key 'b' # Beginning of the previous word.
tmux send-key 'e' # End of next word.
tmux send-key '$' # End of line (just in case we are already at the last line).
tmux send-key 'b' # Beginning of the previous word.
tmux send-key 'e' # End of next word.
else
# emacs copy mode
for (( c=1; c<='30'; c++ )); do # go to the bottom of scrollback buffer
for ((c = 1; c <= '30'; c++)); do # go to the bottom of scrollback buffer
tmux send-key 'C-n'
done
tmux send-key 'C-e'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HELPERS_DIR="$CURRENT_DIR"
# shellcheck source=scripts/helpers.sh

View file

@ -10,4 +10,4 @@
sudo apt-get install -y tmux=1.9a-1~ppa1~p
# configure X11 for xclip testing
echo "export DISPLAY='IP:0.0'" >> /home/vagrant/.bashrc
echo "export DISPLAY='IP:0.0'" >>/home/vagrant/.bashrc

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPTS_DIR="${CURRENT_DIR}/scripts"
HELPERS_DIR="${CURRENT_DIR}/scripts"
@ -18,10 +18,10 @@
for key in $key_bindings; do
if tmux_is_at_least 2.4; then
tmux bind-key -t copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "tmux display-message 'Error! tmux-yank dependencies not installed!'"
tmux bind-key -t copy-mode "$key" send-keys -X copy-pipe-and-cancel "tmux display-message 'Error! tmux-yank dependencies not installed!'"
tmux bind-key -t copy-mode "$key" send-keys -X copy-pipe-and-cancel "tmux display-message 'Error! tmux-yank dependencies not installed!'"
else
tmux bind-key -t vi-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'"
tmux bind-key -t emacs-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'"
tmux bind-key -t vi-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'"
tmux bind-key -t emacs-copy "$key" copy-pipe "tmux display-message 'Error! tmux-yank dependencies not installed!'"
fi
done
}
@ -41,25 +41,25 @@
local copy_wo_newline_command
copy_wo_newline_command="$(clipboard_copy_without_newline_command "$copy_command")"
if tmux_is_at_least 2.4; then
tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
tmux bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
tmux bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
tmux bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
tmux bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
else
tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command"
tmux bind-key -t vi-copy "$(put_key)" copy-pipe "tmux paste-buffer"
tmux bind-key -t vi-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"
tmux bind-key -t vi-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command"
tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command"
tmux bind-key -t vi-copy "$(put_key)" copy-pipe "tmux paste-buffer"
tmux bind-key -t vi-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"
tmux bind-key -t vi-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command"
tmux bind-key -t emacs-copy "$(yank_key)" copy-pipe "$copy_command"
tmux bind-key -t emacs-copy "$(put_key)" copy-pipe "tmux paste-buffer"
tmux bind-key -t emacs-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"
tmux bind-key -t emacs-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command"
tmux bind-key -t emacs-copy "$(yank_key)" copy-pipe "$copy_command"
tmux bind-key -t emacs-copy "$(put_key)" copy-pipe "tmux paste-buffer"
tmux bind-key -t emacs-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"
tmux bind-key -t emacs-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command"
fi
}