Prefer tr to ${char^^}, which does not work on older bash versions (#303)
* Prefer `tr` to ${char^^}, which does not work on older bash versions
* Update CHANGELOG.md
---------
Co-authored-by: ReFil <[email protected]>
This commit is contained in:
+8
-1
@@ -5,11 +5,18 @@ date=$(date -u +"%Y%m%d")
|
||||
branch=${1:-$(git rev-parse --abbrev-ref HEAD | cut -c1-4)}
|
||||
commit=${2:-$(git rev-parse --short HEAD)}
|
||||
|
||||
uppercase_char() {
|
||||
local char=$1
|
||||
|
||||
(echo $char | tr '[a-z]' '[A-Z]' 2> /dev/null) || echo "${char^^}"
|
||||
}
|
||||
|
||||
# Function to transform characters to ZMK key behaviours
|
||||
transform_char() {
|
||||
local char=$1
|
||||
|
||||
if [[ $char =~ [A-Za-z] ]]; then
|
||||
echo "<&kp ${char^^}>, "
|
||||
echo "<&kp $(uppercase_char $char)>, "
|
||||
elif [[ $char =~ [0-9] ]]; then
|
||||
echo "<&kp N${char}>, "
|
||||
elif [ "$char" = "." ]; then
|
||||
|
||||
Reference in New Issue
Block a user