Fix arg order
This commit is contained in:
@@ -6,16 +6,49 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if (($# < 1)); then
|
headline=""
|
||||||
echo "Usage: omarchy-notification-send <headline> [description] [-g <glyph>] [-u <low|normal|critical>] [notify-send options]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
headline=$1
|
|
||||||
description=""
|
description=""
|
||||||
glyph=""
|
glyph=""
|
||||||
urgency="low"
|
urgency="low"
|
||||||
args=()
|
args=()
|
||||||
|
|
||||||
|
parse_omarchy_option() {
|
||||||
|
case $1 in
|
||||||
|
-g | --glyph)
|
||||||
|
if (($# < 2)); then
|
||||||
|
echo "Missing value for $1" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
glyph="$2"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-u | --urgency)
|
||||||
|
if (($# < 2)); then
|
||||||
|
echo "Missing value for $1" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
urgency="$2"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while (($# > 0)); do
|
||||||
|
if parse_omarchy_option "$@"; then
|
||||||
|
shift 2
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if (($# < 1)); then
|
||||||
|
echo "Usage: omarchy-notification-send [-g <glyph>] [-u <low|normal|critical>] <headline> [description] [notify-send options]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
headline=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if (($# > 0)) && [[ $1 != -* ]]; then
|
if (($# > 0)) && [[ $1 != -* ]]; then
|
||||||
@@ -24,20 +57,12 @@ if (($# > 0)) && [[ $1 != -* ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while (($# > 0)); do
|
while (($# > 0)); do
|
||||||
case $1 in
|
if parse_omarchy_option "$@"; then
|
||||||
-g|--glyph)
|
shift 2
|
||||||
glyph="$2"
|
else
|
||||||
shift 2
|
args+=("$1")
|
||||||
;;
|
shift
|
||||||
-u|--urgency)
|
fi
|
||||||
urgency="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
|
||||||
summary="$glyph $headline"
|
summary="$glyph $headline"
|
||||||
|
|||||||
Reference in New Issue
Block a user