From 5120b108ca2dcd78db519226516e071aca7b81d0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 10 Jul 2021 16:00:59 -0400 Subject: shfmt everything --- bin/cryptdir | 2 +- bin/hornet/numkeys | 11 +++++++---- bin/hornet/sc | 30 +++++++++++++++--------------- bin/hornet/ssh | 2 +- bin/hornet/tv | 4 ++-- bin/hornet/twitch | 4 ++-- bin/hornet/update-weather | 2 +- bin/hornet/vscreen | 25 ++++++++++++------------- bin/hornet/watch-kbd | 2 +- bin/hostcert | 2 +- bin/scratch | 2 +- bin/show-colors | 2 +- bin/tozt/learn_spam | 14 +++++++------- bin/vimmanpager | 22 +++++++++++----------- config/sh/aliases | 4 ++-- config/sh/env | 6 +++--- config/sh/functions | 2 +- config/zsh/local-completions/hornet/_sv | 1 + services/available/redshift/run | 2 +- services/available/xcape/run | 2 +- yabairc | 26 +++++++++++++------------- 21 files changed, 85 insertions(+), 82 deletions(-) diff --git a/bin/cryptdir b/bin/cryptdir index 3fb858f..eb63300 100755 --- a/bin/cryptdir +++ b/bin/cryptdir @@ -19,7 +19,7 @@ cryptfile=$(mktemp) cryptdir=$(mktemp -d) pass=$(dd if=/dev/urandom bs=1 count=80 | base64) -cleanup () { +cleanup() { set +e cd sudo umount "$cryptdir" diff --git a/bin/hornet/numkeys b/bin/hornet/numkeys index 9d037f5..9b284bb 100755 --- a/bin/hornet/numkeys +++ b/bin/hornet/numkeys @@ -47,8 +47,11 @@ toggle() { } case "$1" in - on) on ;; - off) off ;; - toggle) toggle ;; - *) echo invalid 1>&2; exit 1 ;; +on) on ;; +off) off ;; +toggle) toggle ;; +*) + echo invalid 1>&2 + exit 1 + ;; esac diff --git a/bin/hornet/sc b/bin/hornet/sc index d86b917..614a1bc 100755 --- a/bin/hornet/sc +++ b/bin/hornet/sc @@ -1,19 +1,19 @@ #!/bin/sh case "$1" in - on) - xset s 300 5 - xset dpms 600 600 600 - ;; - off) - xset s off - xset dpms 0 0 0 - ;; - q) - xset q | perl -nlE'print if ((/^(:?Screen Saver|DPMS)/.../^[^\s]/) && /^(:?Screen Saver|DPMS|\s)/)' - ;; - *) - echo "$(basename "$0"): unknown argument '$1'" >&2 - exit 1 - ;; +on) + xset s 300 5 + xset dpms 600 600 600 + ;; +off) + xset s off + xset dpms 0 0 0 + ;; +q) + xset q | perl -nlE'print if ((/^(:?Screen Saver|DPMS)/.../^[^\s]/) && /^(:?Screen Saver|DPMS|\s)/)' + ;; +*) + echo "$(basename "$0"): unknown argument '$1'" >&2 + exit 1 + ;; esac diff --git a/bin/hornet/ssh b/bin/hornet/ssh index 65c2f53..bbacdf9 100755 --- a/bin/hornet/ssh +++ b/bin/hornet/ssh @@ -2,5 +2,5 @@ set -eu set -o pipefail -ssh-add -l | grep -q "${HOME}/.ssh/id_rsa" || env SSH_ASKPASS="ssh-askpass" ssh-add < /dev/null +ssh-add -l | grep -q "${HOME}/.ssh/id_rsa" || env SSH_ASKPASS="ssh-askpass" ssh-add ~/.weechat/weechat_fifo + echo '*/buffer close twitch.#' >~/.weechat/weechat_fifo else ssh partofme sh -c "'nohup twitch ${1} > /dev/null 2>&1 &'" - echo "irc.server.twitch */join #${1}" > ~/.weechat/weechat_fifo + echo "irc.server.twitch */join #${1}" >~/.weechat/weechat_fifo fi diff --git a/bin/hornet/update-weather b/bin/hornet/update-weather index 8105223..fad6ff7 100755 --- a/bin/hornet/update-weather +++ b/bin/hornet/update-weather @@ -2,5 +2,5 @@ set -eu set -o pipefail -weather > ~/.cache/weather.new +weather >~/.cache/weather.new mv ~/.cache/weather.new ~/.cache/weather diff --git a/bin/hornet/vscreen b/bin/hornet/vscreen index d39b389..52fc5cc 100755 --- a/bin/hornet/vscreen +++ b/bin/hornet/vscreen @@ -1,17 +1,16 @@ #!/bin/sh - case "$1" in - goto) - xrandr --addmode VIRTUAL1 1920x1080 - xrandr --output VIRTUAL1 --auto --output eDP1 --auto --left-of VIRTUAL1 - i3-switch-workspace virtual - ;; - off) - xrandr --output VIRTUAL1 --off - ;; - *) - echo "bad subcommand $1" >&2 - exit 1 - ;; +goto) + xrandr --addmode VIRTUAL1 1920x1080 + xrandr --output VIRTUAL1 --auto --output eDP1 --auto --left-of VIRTUAL1 + i3-switch-workspace virtual + ;; +off) + xrandr --output VIRTUAL1 --off + ;; +*) + echo "bad subcommand $1" >&2 + exit 1 + ;; esac diff --git a/bin/hornet/watch-kbd b/bin/hornet/watch-kbd index d5cd583..2516f6b 100755 --- a/bin/hornet/watch-kbd +++ b/bin/hornet/watch-kbd @@ -4,7 +4,7 @@ set -o pipefail trap 'kill $(jobs -p)' EXIT -inotifywait -mq -e create -e delete --exclude '.*tmp.*' /dev/input/by-id/ | \ +inotifywait -mq -e create -e delete --exclude '.*tmp.*' /dev/input/by-id/ | while read -r event; do echo "$event" if echo "$event" | grep -q USB_Keyboard; then diff --git a/bin/hostcert b/bin/hostcert index 545167a..61f519d 100755 --- a/bin/hostcert +++ b/bin/hostcert @@ -5,4 +5,4 @@ set -o pipefail host="$1" port="${2:-443}" -openssl s_client -connect "$host:$port" < /dev/null 2>/dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/' +openssl s_client -connect "$host:$port" /dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/' diff --git a/bin/scratch b/bin/scratch index 06bccb0..0cca01c 100755 --- a/bin/scratch +++ b/bin/scratch @@ -2,4 +2,4 @@ set -eu set -o pipefail -cat > /dev/null +cat >/dev/null diff --git a/bin/show-colors b/bin/show-colors index be1a489..47e0d32 100755 --- a/bin/show-colors +++ b/bin/show-colors @@ -7,7 +7,7 @@ set -o pipefail # Last change: Mon Feb 16 16:24:41 CET 2004 ############################################################ -for attr in 0 1 2 3 4 5 6 7 ; do +for attr in 0 1 2 3 4 5 6 7; do echo "----------------------------------------------------------------" printf 'ESC[%s;Foreground;Background - \n' $attr for fore in 30 31 32 33 34 35 36 37; do diff --git a/bin/tozt/learn_spam b/bin/tozt/learn_spam index 128ca9a..75e500a 100755 --- a/bin/tozt/learn_spam +++ b/bin/tozt/learn_spam @@ -17,21 +17,21 @@ fi if [ ! "$1" = "-q" ]; then echo "$(date): Learning ham..." fi -nice find $MAILDIR -type f | \ - perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && !m{/(\.old|\.spam)/} && $ts > $now - 60*60*24*30' | \ - xargs -n1000 -0 $SALEARN "$OPTS" --ham > $OUTFILE +nice find $MAILDIR -type f | + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && !m{/(\.old|\.spam)/} && $ts > $now - 60*60*24*30' | + xargs -n1000 -0 $SALEARN "$OPTS" --ham >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Learning spam..." fi -nice find $MAILDIR -type f | \ - perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && m{/\.spam/} && $ts > $now - 60*60*24*30' | \ - xargs -n1000 -0 $SALEARN "$OPTS" --spam > $OUTFILE +nice find $MAILDIR -type f | + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && m{/\.spam/} && $ts > $now - 60*60*24*30' | + xargs -n1000 -0 $SALEARN "$OPTS" --spam >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Syncing..." fi -nice $SALEARN --sync > $OUTFILE +nice $SALEARN --sync >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Done!" diff --git a/bin/vimmanpager b/bin/vimmanpager index d33e4f9..dfd36f3 100755 --- a/bin/vimmanpager +++ b/bin/vimmanpager @@ -2,14 +2,14 @@ set -eu set -o pipefail -sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \ - vim \ - -c 'let no_plugin_maps = 1' \ - -c 'let g:rainbow_active = 0' \ - -c 'let g:airline#extensions#whitespace#checks = []' \ - -c "if exists('\$MAN_PN') | file \$MAN_PN | endif" \ - -c 'setlocal nolist nomod noswf ft=man' \ - -c 'runtime! macros/less.vim' \ - -c 'set ma' \ - -c 'setlocal noma' \ - - +sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | + vim \ + -c 'let no_plugin_maps = 1' \ + -c 'let g:rainbow_active = 0' \ + -c 'let g:airline#extensions#whitespace#checks = []' \ + -c "if exists('\$MAN_PN') | file \$MAN_PN | endif" \ + -c 'setlocal nolist nomod noswf ft=man' \ + -c 'runtime! macros/less.vim' \ + -c 'set ma' \ + -c 'setlocal noma' \ + - diff --git a/config/sh/aliases b/config/sh/aliases index 97a1457..cc6c8a6 100644 --- a/config/sh/aliases +++ b/config/sh/aliases @@ -6,8 +6,8 @@ alias rm="rm -i" alias cp="cp -i" alias mv="mv -i" alias bc="bc -lq" -type forkprove > /dev/null 2>&1 && alias prove="forkprove" -type tput > /dev/null 2>&1 && alias reset="tput reset" +type forkprove >/dev/null 2>&1 && alias prove="forkprove" +type tput >/dev/null 2>&1 && alias reset="tput reset" # }}} # games {{{ alias nao="ssh nethack@alt.org" diff --git a/config/sh/env b/config/sh/env index bc0bc9c..9887d1d 100644 --- a/config/sh/env +++ b/config/sh/env @@ -9,7 +9,7 @@ if [ -x "$ssh" ]; then export GIT_SSH="$ssh" export RSYNC_RSH="$ssh" fi -if type sudo-askpass > /dev/null 2>&1; then +if type sudo-askpass >/dev/null 2>&1; then SUDO_ASKPASS=$(command -v sudo-askpass) export SUDO_ASKPASS fi @@ -20,7 +20,7 @@ export FZF_DEFAULT_OPTS="--reverse --inline-info --bind=tab:down,shift-tab:up,ch export FZF_DEFAULT_COMMAND="ag --hidden -l ." export FANCY_PROMPT_COLORS="user_doy=bright_blue,host_st-doy2=bright_white,host_tozt=bright_yellow,host_partofme=magenta,host_mail=green,host_hornet=red" export PASSWORD_STORE_X_SELECTION=primary -type brew > /dev/null 2>&1 && export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:$PATH" -type brew > /dev/null 2>&1 && export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:/usr/local/opt/findutils/libexec/gnuman:$MANPATH" +type brew >/dev/null 2>&1 && export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:$PATH" +type brew >/dev/null 2>&1 && export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:/usr/local/opt/findutils/libexec/gnuman:$MANPATH" # vim:ft=sh: diff --git a/config/sh/functions b/config/sh/functions index a662f2d..76db947 100644 --- a/config/sh/functions +++ b/config/sh/functions @@ -1,6 +1,6 @@ function perldoc { # XXX bash specific - if type cpandoc > /dev/null 2>&1; then + if type cpandoc >/dev/null 2>&1; then cpandoc "$@" else command perldoc "$@" diff --git a/config/zsh/local-completions/hornet/_sv b/config/zsh/local-completions/hornet/_sv index b67ef08..218e95f 100644 --- a/config/zsh/local-completions/hornet/_sv +++ b/config/zsh/local-completions/hornet/_sv @@ -6,4 +6,5 @@ service_list=(${(f)services}) _describe 'commands' service_list +# shfmt:skip (shfmt doesn't recognize zsh array expansion) # vim:ft=zsh diff --git a/services/available/redshift/run b/services/available/redshift/run index a360643..60c11cd 100755 --- a/services/available/redshift/run +++ b/services/available/redshift/run @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec redshift -l "$(sed 's/,/:/' < ~/.config/darksky/location)" 2>&1 +exec redshift -l "$(sed 's/,/:/' <~/.config/darksky/location)" 2>&1 diff --git a/services/available/xcape/run b/services/available/xcape/run index d4e95d0..42b65b5 100755 --- a/services/available/xcape/run +++ b/services/available/xcape/run @@ -1,3 +1,3 @@ #!/bin/sh -exec xcape -d -e 'Control_L=Escape;Control_R=Escape' > /dev/null 2>&1 +exec xcape -d -e 'Control_L=Escape;Control_R=Escape' >/dev/null 2>&1 diff --git a/yabairc b/yabairc index 6ad06cb..da2b5f4 100755 --- a/yabairc +++ b/yabairc @@ -1,19 +1,19 @@ #!/usr/bin/env sh set -eu -yabai -m config focus_follows_mouse autofocus -yabai -m config window_topmost on -yabai -m config split_ratio 0.50 -yabai -m config auto_balance off -yabai -m config mouse_modifier fn -yabai -m config mouse_action1 move -yabai -m config mouse_action2 resize +yabai -m config focus_follows_mouse autofocus +yabai -m config window_topmost on +yabai -m config split_ratio 0.50 +yabai -m config auto_balance off +yabai -m config mouse_modifier fn +yabai -m config mouse_action1 move +yabai -m config mouse_action2 resize -yabai -m config layout bsp -yabai -m config top_padding 2 -yabai -m config bottom_padding 2 -yabai -m config left_padding 2 -yabai -m config right_padding 2 -yabai -m config window_gap 2 +yabai -m config layout bsp +yabai -m config top_padding 2 +yabai -m config bottom_padding 2 +yabai -m config left_padding 2 +yabai -m config right_padding 2 +yabai -m config window_gap 2 echo "yabai configuration loaded.." -- cgit v1.2.3-54-g00ecf