mirror of
https://github.com/yshui/picom.git
synced 2025-02-17 15:56:21 -05:00
picom-trans: Use POSIX-compatible getopts
This commit is contained in:
parent
7b4af3aef6
commit
df1c6159fc
1 changed files with 5 additions and 6 deletions
|
@ -82,16 +82,15 @@ for v in "$@"; do
|
||||||
shift && set -- "$@" "$(echo "$v" | sed -E 's/^-([0-9]+%?)$/~\1/')"
|
shift && set -- "$@" "$(echo "$v" | sed -E 's/^-([0-9]+%?)$/~\1/')"
|
||||||
done
|
done
|
||||||
|
|
||||||
# This takes into account the fact that getopts stops on
|
# We make getopts stop on any argument it doesn't recognize
|
||||||
# any argument it doesn't recognize or errors on. This
|
# or errors on. This allows for things like `picom-trans -5`
|
||||||
# allows for things like `picom-trans -5` as well
|
# as well as `picom-trans -c +5 -s` (contrived example).
|
||||||
# as `picom-trans -c +5 -s` (contrived example).
|
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
# Reset option index
|
# Reset option index
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
|
|
||||||
# Read options
|
# Read options
|
||||||
while getopts 'hscrtdgn:w:o:-:' option "$@"; do
|
while getopts ':hscrtdgn:w:o:-:' option "$@"; do
|
||||||
if test "$option" = '-'; then
|
if test "$option" = '-'; then
|
||||||
case "$OPTARG" in
|
case "$OPTARG" in
|
||||||
help | select | current | reset | toggle | delete | get)
|
help | select | current | reset | toggle | delete | get)
|
||||||
|
@ -127,7 +126,7 @@ while test $# -gt 0; do
|
||||||
n) wprefix='-name'; window=$OPTARG ;;
|
n) wprefix='-name'; window=$OPTARG ;;
|
||||||
w) wprefix='-id'; window=$OPTARG ;;
|
w) wprefix='-id'; window=$OPTARG ;;
|
||||||
o) opacity=$OPTARG ;;
|
o) opacity=$OPTARG ;;
|
||||||
\?) exit 1 ;;
|
\?) break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue