binscripts: make indentation consistent

This commit is contained in:
Henrik Lissner 2017-12-18 01:12:13 -05:00
parent e6ace9c085
commit 9166534b29
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 63 additions and 63 deletions

View file

@ -4,26 +4,26 @@
# Linux).
if [[ -t 0 ]]; then
if command -v xclip >/dev/null; then
xclip -display :0 -selection clipboard -out
elif command -v xsel >/dev/null; then
xsel --clipboard --output
elif command -v pbpaste >/dev/null; then
pbpaste
else
>&2 echo "No clipboard detected. Aborting."
exit 1
fi
if command -v xclip >/dev/null; then
xclip -display :0 -selection clipboard -out
elif command -v xsel >/dev/null; then
xsel --clipboard --output
elif command -v pbpaste >/dev/null; then
pbpaste
else
>&2 echo "No clipboard detected. Aborting."
exit 1
fi
else
if command -v xclip >/dev/null; then
xclip -display :0 -selection clipboard -in
elif command -v xsel >/dev/null; then
xsel --clipboard --input
elif command -v pbcopy >/dev/null; then
pbcopy
else
>&2 echo "No clipboard detected. Aborting."
exit 1
fi
if command -v xclip >/dev/null; then
xclip -display :0 -selection clipboard -in
elif command -v xsel >/dev/null; then
xsel --clipboard --input
elif command -v pbcopy >/dev/null; then
pbcopy
else
>&2 echo "No clipboard detected. Aborting."
exit 1
fi
fi

View file

@ -7,34 +7,34 @@
set -e
if (($# == 0)); then
>&2 echo "Usage: $0 <FILE|DIRECTORY> [DEST]"
exit 1
>&2 echo "Usage: $0 <FILE|DIRECTORY> [DEST]"
exit 1
fi
ext='clump'
target="$1"
cmd=
if [[ -f $target ]]; then
cmd=unpack
cmd=unpack
elif [[ -d $target ]]; then
cmd=pack
cmd=pack
else
>&2 echo "Not a valid target: '$target'"
exit 1
>&2 echo "Not a valid target: '$target'"
exit 1
fi
case $cmd in
p|pack)
if [[ -f $target.$ext ]]; then
>&2 echo "Destination file already exists"
exit 2
fi
tar -pcvf - "$target" | gpg -c > "$target.$ext"
echo "Packed into $target.$ext"
;;
u|unpack)
tmpfile=$(mktemp)
gpg -d "$target" > "$tmpfile" && tar -pxvf "$tmpfile"
rm -f "$tmpfile"
;;
p|pack)
if [[ -f $target.$ext ]]; then
>&2 echo "Destination file already exists"
exit 2
fi
tar -pcvf - "$target" | gpg -c > "$target.$ext"
echo "Packed into $target.$ext"
;;
u|unpack)
tmpfile=$(mktemp)
gpg -d "$target" > "$tmpfile" && tar -pxvf "$tmpfile"
rm -f "$tmpfile"
;;
esac

View file

@ -15,10 +15,10 @@ ENTITIES = {value: key for key, value in entitydefs.items()}
def encode(text):
t = ""
for c in text:
if c in ENTITIES:
t += "&" + ENTITIES[c] + ";"
else:
t += c
if c in ENTITIES:
t += "&" + ENTITIES[c] + ";"
else:
t += c
return t
def decode(text):

View file

@ -21,26 +21,26 @@ bin="${0##*/}"
flags=
while getopts p:i:l: opt; do
case $opt in
p) flags+=" -p $OPTARG" ;;
i) flags+=" -i $OPTARG" ;;
l) flags+=" -l $OPTARG" ;;
*) >&2 echo "Invalid option $OPTARG"
exit 1
;;
esac
case $opt in
p) flags+=" -p $OPTARG" ;;
i) flags+=" -i $OPTARG" ;;
l) flags+=" -l $OPTARG" ;;
*) >&2 echo "Invalid option $OPTARG"
exit 1
;;
esac
done
shift $((OPTIND-1))
target="$1"
if [[ $target ]]; then
if [[ -t 0 ]]; then
pb | $bin $target
else
ssh $flags -qt "$target" "pb" && echo "Sent to $target"
fi
if [[ -t 0 ]]; then
pb | $bin $target
else
ssh $flags -qt "$target" "pb" && echo "Sent to $target"
fi
else
pb
pb
fi
# vim:set ft=sh:

View file

@ -2,11 +2,11 @@
# A script that takes a screenshot and stores it in the clipboard
tmp=$(mktemp)
if maim -us >"$tmp"; then
xclip -selection clipboard -t image/png "$tmp" && \
ding && \
notify-send "Screenshot saved"
xclip -selection clipboard -t image/png "$tmp" && \
ding && \
notify-send "Screenshot saved"
else
notify-send -u low "Screenshot aborted"
ding error
notify-send -u low "Screenshot aborted"
ding error
fi
rm -f "$tmp"
rm -f "$tmp"