release.sh: select_arrow con printf+ANSI directo, fix syntax
This commit is contained in:
65
release.sh
65
release.sh
@@ -21,56 +21,52 @@ cursor_off() { tput civis; }
|
|||||||
cursor_on() { tput cnorm; }
|
cursor_on() { tput cnorm; }
|
||||||
|
|
||||||
# ── arrow selector ──
|
# ── arrow selector ──
|
||||||
# usage: select_arrow "opt1" "opt2" ... → prints chosen, returns 0
|
|
||||||
select_arrow() {
|
select_arrow() {
|
||||||
local opts=("$@")
|
local opts=("$@")
|
||||||
local sel=0
|
local sel=0 key i n=${#opts[@]}
|
||||||
local row
|
|
||||||
row=$(tput lines)
|
|
||||||
row=$(( row - ${#opts[@]} - 1 ))
|
|
||||||
local col=4
|
|
||||||
local key
|
|
||||||
|
|
||||||
|
for i in "${!opts[@]}"; do
|
||||||
|
if [ "$i" -eq "$sel" ]; then
|
||||||
|
printf " ${C}❯ ${opts[$i]}${N}\n"
|
||||||
|
else
|
||||||
|
printf " ${opts[$i]}\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf '\033[%dA' "$n"
|
||||||
cursor_off
|
cursor_off
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
for i in "${!opts[@]}"; do
|
|
||||||
tput cup "$(( row + i ))" "$col"
|
|
||||||
if [ "$i" -eq "$sel" ]; then
|
|
||||||
printf "${C}❯ ${opts[$i]}${N} \033[K"
|
|
||||||
else
|
|
||||||
printf " ${opts[$i]} \033[K"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS= read -rsn1 key
|
IFS= read -rsn1 key
|
||||||
if [[ $key == $'\x1b' ]]; then
|
if [[ $key == $'\x1b' ]]; then
|
||||||
read -rsn2 key
|
read -rsn2 -t 0.01 key || key=''
|
||||||
case "$key" in
|
case "$key" in
|
||||||
'[A') (( sel > 0 )) && (( sel-- )) ;;
|
'[A') (( sel > 0 )) && (( sel-- )) ;;
|
||||||
'[B') (( sel < ${#opts[@]} - 1 )) && (( sel++ )) ;;
|
'[B') (( sel < n - 1 )) && (( sel++ )) ;;
|
||||||
esac
|
esac
|
||||||
elif [[ $key == "" ]]; then
|
elif [[ -z "$key" || "$key" == $'\n' || "$key" == $'\r' ]]; then
|
||||||
# clear selection lines
|
printf '\033[%dA\033[J' "$n"
|
||||||
for i in "${!opts[@]}"; do
|
|
||||||
tput cup "$(( row + i ))" "$col"
|
|
||||||
printf " \033[K"
|
|
||||||
done
|
|
||||||
cursor_on
|
cursor_on
|
||||||
echo "${opts[$sel]}"
|
printf '%s\n' "${opts[$sel]}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for i in "${!opts[@]}"; do
|
||||||
|
if [ "$i" -eq "$sel" ]; then
|
||||||
|
printf "\033[2K\r ${C}❯ ${opts[$i]}${N}\n"
|
||||||
|
else
|
||||||
|
printf "\033[2K\r ${opts[$i]}\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf '\033[%dA' "$n"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── progress bar (fixed position) ──
|
# ── progress bar ──
|
||||||
PROGRESS_ROW=0
|
|
||||||
set_progress_row() { PROGRESS_ROW=$(tput lines); }
|
|
||||||
progress() {
|
progress() {
|
||||||
local pct=$1 msg=$2
|
local pct=$1 msg=$2
|
||||||
local filled=$(( pct * blen / 100 ))
|
local filled=$(( pct * blen / 100 ))
|
||||||
local empty=$(( blen - filled ))
|
local empty=$(( blen - filled ))
|
||||||
local offset=$(( PROGRESS_ROW - 2 ))
|
printf "\r${C}[${bar:0:filled}${N}${bar:0:empty}${C}]${N} %3d%% %s\033[K" "$pct" "$msg"
|
||||||
tput cup "$offset" 0
|
|
||||||
printf "${C}[${bar:0:filled}${N}${bar:0:empty}${C}]${N} %3d%% %s\033[K" "$pct" "$msg"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── ── ── ── ── ── ── ── ──
|
# ── ── ── ── ── ── ── ── ──
|
||||||
@@ -104,7 +100,6 @@ if [ "$CHOICE" != "Yes" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set_progress_row
|
|
||||||
export JAVA_HOME="$JAVA_HOME"
|
export JAVA_HOME="$JAVA_HOME"
|
||||||
|
|
||||||
# ── clean ──
|
# ── clean ──
|
||||||
@@ -120,9 +115,7 @@ progress 12 "Dependencies... done"
|
|||||||
# ── build AAB ──
|
# ── build AAB ──
|
||||||
progress 12 "Building release AAB..."
|
progress 12 "Building release AAB..."
|
||||||
BUILD_OUTPUT=$("$FLUTTER" build appbundle --release 2>&1) || {
|
BUILD_OUTPUT=$("$FLUTTER" build appbundle --release 2>&1) || {
|
||||||
echo
|
echo -e "\n${R}✗ Build failed:${N}"
|
||||||
tput cup "$(( PROGRESS_ROW - 1 ))" 0
|
|
||||||
echo -e "${R}✗ Build failed:${N}"
|
|
||||||
echo "$BUILD_OUTPUT"
|
echo "$BUILD_OUTPUT"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -138,9 +131,7 @@ if [ -d "$SYMBOLS_DIR" ]; then
|
|||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
progress 95 "Symbols packaged"
|
progress 95 "Symbols packaged"
|
||||||
else
|
else
|
||||||
echo
|
echo -e "\n${Y}⚠ No native libs found${N}"
|
||||||
tput cup "$(( PROGRESS_ROW - 1 ))" 0
|
|
||||||
echo -e "${Y}⚠ No native libs found${N}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── verify ──
|
# ── verify ──
|
||||||
|
|||||||
Reference in New Issue
Block a user