Shell cosmetic changes
This commit is contained in:
parent
a444cdcbfd
commit
0f6b0e5133
@ -85,14 +85,10 @@ pass=no
|
||||
user=no
|
||||
while getopts mpu flag; do
|
||||
case $flag in
|
||||
m) mfa=check
|
||||
;;
|
||||
p) pass=check
|
||||
;;
|
||||
u) user=check
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
m) mfa=check ;;
|
||||
p) pass=check ;;
|
||||
u) user=check ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
10
bin/fetch.sh
10
bin/fetch.sh
@ -65,11 +65,11 @@ for url; do
|
||||
mkdir -p "$outdir"
|
||||
|
||||
{
|
||||
fetch_cmd -o "$outdir/file" "$url" \
|
||||
&& printf "%s\n" "$url" >"$outdir/url" \
|
||||
&& printf "%s\n" "$name" >"$outdir/name" \
|
||||
&& printf "%s\n" "$url" >>"$everything" \
|
||||
&& printf "%s\n" "$outdir/file"
|
||||
fetch_cmd -o "$outdir/file" "$url" &&
|
||||
printf "%s\n" "$url" >"$outdir/url" &&
|
||||
printf "%s\n" "$name" >"$outdir/name" &&
|
||||
printf "%s\n" "$url" >>"$everything" &&
|
||||
printf "%s\n" "$outdir/file"
|
||||
} || rc=1
|
||||
done
|
||||
exit $rc
|
||||
|
@ -47,9 +47,11 @@ case $infile in
|
||||
*.jpg | *.jpeg)
|
||||
inprog=jpegtopnm
|
||||
;;
|
||||
*.png) inprog=pngtopam
|
||||
*.png)
|
||||
inprog=pngtopam
|
||||
;;
|
||||
*) err "unknown input format"
|
||||
*)
|
||||
err "unknown input format"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -58,9 +60,11 @@ case $outfile in
|
||||
*.jpg | *.jpeg)
|
||||
outprog=pnmtojpeg
|
||||
;;
|
||||
*.png) outprog=pamtopng
|
||||
*.png)
|
||||
outprog=pamtopng
|
||||
;;
|
||||
*) err "unknown output format"
|
||||
*)
|
||||
err "unknown output format"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -53,7 +53,8 @@ get_id_query()
|
||||
id=
|
||||
for param; do
|
||||
case $param in
|
||||
v=*) id=${param#v=}
|
||||
v=*)
|
||||
id=${param#v=}
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@ -78,10 +79,8 @@ get_id()
|
||||
torsocks=torsocks
|
||||
while getopts T flag; do
|
||||
case $flag in
|
||||
T) torsocks=
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
T) torsocks= ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
14
bin/plumb.sh
14
bin/plumb.sh
@ -12,7 +12,7 @@
|
||||
|
||||
usage()
|
||||
{
|
||||
printf "Usage: %s [-T] [URI|file]\n" "${0##*/}">&2
|
||||
printf "Usage: %s [-T] [URI|file]\n" "${0##*/}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -32,10 +32,8 @@ check_required_program fetch
|
||||
Tflag=
|
||||
while getopts T flag; do
|
||||
case $flag in
|
||||
T) Tflag=-T
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
T) Tflag=-T ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
@ -55,7 +53,8 @@ case $target in
|
||||
http://* | https://*)
|
||||
file=$(fetch $Tflag "$target") || err "couldn't fetch $target"
|
||||
;;
|
||||
*) [ -f "$target" ] || err "can't handle $uri"
|
||||
*)
|
||||
[ -f "$target" ] || err "can't handle $uri"
|
||||
file=$target
|
||||
;;
|
||||
esac
|
||||
@ -84,6 +83,7 @@ video/*)
|
||||
check_required_program mpv
|
||||
mpv "$file"
|
||||
;;
|
||||
*) err "don't know how to open $mimetype"
|
||||
*)
|
||||
err "don't know how to open $mimetype"
|
||||
;;
|
||||
esac
|
||||
|
@ -32,10 +32,8 @@ tonumber()
|
||||
torsocks=torsocks
|
||||
while getopts T flag; do
|
||||
case $flag in
|
||||
T) torsocks=
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
T) torsocks= ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
@ -29,18 +29,23 @@ err()
|
||||
}
|
||||
|
||||
case $# in
|
||||
0) set -- -root
|
||||
0)
|
||||
set -- -root
|
||||
;;
|
||||
1) [ "$1" = "-window" ] || err "unknown option $1"
|
||||
1)
|
||||
[ "$1" = "-window" ] || err "unknown option $1"
|
||||
set --
|
||||
;;
|
||||
2) [ "$1" = "-id" ] || [ "$1" = "-name" ] || err "unknown option $1"
|
||||
2)
|
||||
[ "$1" = "-id" ] || [ "$1" = "-name" ] || err "unknown option $1"
|
||||
[ -n "$2" ] || err "$1 expects a non-empty parameter"
|
||||
;;
|
||||
*) usage
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
: ${SCREENSHOTS:=~/media/ss}
|
||||
xwd -silent "$@" | xwdtopnm |
|
||||
xwd -silent "$@" |
|
||||
xwdtopnm |
|
||||
pnmtopng >"$SCREENSHOTS/$(date +%Y%m%d-%H%M%S).png"
|
||||
|
@ -22,8 +22,8 @@
|
||||
#
|
||||
# sekrit get account/user | xclip -r -l 1 -sel clip -q
|
||||
# sekrit get account/pass | xclip -r -l 1 -sel clip -q
|
||||
# sekrit has account/2fa && sekrit get account/2fa \
|
||||
# | $program_for_totp | xclip -r -l 1 -sel clip -q
|
||||
# sekrit has account/2fa && sekrit get account/2fa |
|
||||
# $program_for_totp | xclip -r -l 1 -sel clip -q
|
||||
|
||||
usage()
|
||||
{
|
||||
@ -67,10 +67,8 @@ sekrit_add()
|
||||
OPTIND=1
|
||||
while getopts f flag; do
|
||||
case "$flag" in
|
||||
k) force=yes
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
k) force=yes ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
@ -104,10 +102,8 @@ sekrit_cp()
|
||||
rmlastnl=-rmlastnl
|
||||
while getopts k flag; do
|
||||
case "$flag" in
|
||||
k) rmlastnl=
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
k) rmlastnl= ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
@ -128,8 +124,7 @@ sekrit_gen()
|
||||
l) len=$(to_number "$OPTARG") ||
|
||||
err "invalid password length"
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
@ -142,7 +137,8 @@ sekrit_gen()
|
||||
chars=$1
|
||||
fi
|
||||
|
||||
tr -cd -- "$chars" </dev/urandom | dd bs=1 count="$len" 2>/dev/null &&
|
||||
tr -cd -- "$chars" </dev/urandom |
|
||||
dd bs=1 count="$len" 2>/dev/null &&
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
@ -171,7 +167,8 @@ sekrit_has()
|
||||
ls_key()
|
||||
{
|
||||
d=$SEKRIT_DIR$1
|
||||
find "$d" -type f -name "*.gpg" | sort |
|
||||
find "$d" -type f -name "*.gpg" |
|
||||
sort |
|
||||
sed -e "s#^$d##" -e "s#\.gpg\$##"
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# env
|
||||
# Written in 2019 by Lucas
|
||||
# Written in 2019-2020 by Lucas
|
||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all
|
||||
@ -18,8 +18,12 @@ export PATH HOME TERM LC_CTYPE
|
||||
case "$-" in
|
||||
*i*)
|
||||
case "$SHELL" in
|
||||
/bin/bash) . ~/.shrc ;;
|
||||
/bin/ksh | /bin/loksh | /bin/mksh) export ENV=~/.shrc ;;
|
||||
/bin/bash)
|
||||
. ~/.shrc
|
||||
;;
|
||||
*)
|
||||
export ENV=~/.shrc
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# env
|
||||
# Written in 2019 by Lucas
|
||||
# Written in 2019-2020 by Lucas
|
||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all
|
||||
@ -45,13 +45,15 @@ case $SHELL in
|
||||
/bin/mksh)
|
||||
PS1=$PS1'${HOSTNAME:=$(hostname -s)}\$ '
|
||||
;;
|
||||
*) PS1=$PS1'\h\$ '
|
||||
*)
|
||||
PS1=$PS1'\h\$ '
|
||||
;;
|
||||
esac
|
||||
export PS1
|
||||
|
||||
case $(uname -s) in
|
||||
Linux) stty erase "^?"
|
||||
Linux)
|
||||
stty erase "^?"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -19,9 +19,9 @@ setxkbmap \
|
||||
xset r rate 300 75
|
||||
|
||||
xset b off
|
||||
test -d /usr/local/share/fonts/bitmaps \
|
||||
&& xset +fp /usr/local/share/fonts/bitmaps \
|
||||
&& xset fp rehash
|
||||
test -d /usr/local/share/fonts/bitmaps &&
|
||||
xset +fp /usr/local/share/fonts/bitmaps &&
|
||||
xset fp rehash
|
||||
test -r ~/.Xresources && xrdb -merge ~/.Xresources
|
||||
|
||||
exec herbstluftwm -l >~/local/var/log/herbstluftwm 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user