binscripts: make indentation consistent
This commit is contained in:
parent
e6ace9c085
commit
9166534b29
40
bin/clip
40
bin/clip
|
@ -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
|
||||
|
||||
|
|
38
bin/gpgzip
38
bin/gpgzip
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
28
bin/rclip
28
bin/rclip
|
@ -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:
|
||||
|
|
10
bin/ssclip
10
bin/ssclip
|
@ -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"
|
Loading…
Reference in a new issue