unoverse 0.1.51 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/operator/lib/common.sh +45 -0
- package/operator/lib/deploy.sh +3 -9
- package/package.json +1 -1
package/operator/lib/common.sh
CHANGED
|
@@ -56,3 +56,48 @@ timer_elapsed() {
|
|
|
56
56
|
# The old "studio mode" system (mode file, is_platform_mode, require_platform_mode)
|
|
57
57
|
# was removed 2026-07-28: Studio is a separate app now, and this CLI has one job:
|
|
58
58
|
# operate a universe. See _legacy/scripts-lib/ for the retired authoring tools.
|
|
59
|
+
|
|
60
|
+
# ── pick_option: the arrow-key list, for bash ────────────────────────────────
|
|
61
|
+
# Same interaction as the create menu (packages/cli/lib/create.mjs): up/down move,
|
|
62
|
+
# a digit jumps, Enter takes it. Sets PICKED (0-based). Not a TTY falls back to
|
|
63
|
+
# reading a number, so scripted runs keep working.
|
|
64
|
+
pick_option() {
|
|
65
|
+
local active=0 n=$# i k k2
|
|
66
|
+
local opts=("$@")
|
|
67
|
+
PICKED=0
|
|
68
|
+
if [ ! -t 0 ]; then
|
|
69
|
+
local line
|
|
70
|
+
IFS= read -r line || true
|
|
71
|
+
case "$line" in [1-9]) [ "$line" -le "$n" ] && PICKED=$((line-1));; esac
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
_po_draw() {
|
|
75
|
+
for ((i=0; i<n; i++)); do
|
|
76
|
+
if [ "$i" -eq "$active" ]; then
|
|
77
|
+
printf ' \033[36m❯\033[0m %d \033[1m%s\033[0m\033[K\n' $((i+1)) "${opts[$i]}"
|
|
78
|
+
else
|
|
79
|
+
printf ' %d %s\033[K\n' $((i+1)) "${opts[$i]}"
|
|
80
|
+
fi
|
|
81
|
+
done
|
|
82
|
+
printf ' \033[2m↑↓ to move, Enter to choose\033[0m\033[K'
|
|
83
|
+
}
|
|
84
|
+
printf '\033[?25l'
|
|
85
|
+
_po_draw
|
|
86
|
+
while true; do
|
|
87
|
+
IFS= read -rsn1 k || break
|
|
88
|
+
case "$k" in
|
|
89
|
+
$'\x1b')
|
|
90
|
+
IFS= read -rsn2 -t 1 k2 || k2=""
|
|
91
|
+
case "$k2" in
|
|
92
|
+
'[A') active=$(( (active-1+n)%n ));;
|
|
93
|
+
'[B') active=$(( (active+1)%n ));;
|
|
94
|
+
esac ;;
|
|
95
|
+
[1-9]) [ "$k" -le "$n" ] 2>/dev/null && active=$((k-1)) ;;
|
|
96
|
+
""|$'\n') break ;;
|
|
97
|
+
esac
|
|
98
|
+
printf '\r\033[%dA' "$n"
|
|
99
|
+
_po_draw
|
|
100
|
+
done
|
|
101
|
+
printf '\033[?25h\n'
|
|
102
|
+
PICKED=$active
|
|
103
|
+
}
|
package/operator/lib/deploy.sh
CHANGED
|
@@ -31,15 +31,9 @@ cmd_deploy() {
|
|
|
31
31
|
echo ""
|
|
32
32
|
echo -e " ${CYAN}${BOLD}Where should this universe live?${NC}"
|
|
33
33
|
echo ""
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
local cloud_choice cloud
|
|
38
|
-
read -r -p " Enter to choose, or type 2: " cloud_choice
|
|
39
|
-
case "$cloud_choice" in
|
|
40
|
-
2) cloud=aws ;;
|
|
41
|
-
*) cloud=digitalocean ;;
|
|
42
|
-
esac
|
|
34
|
+
local cloud
|
|
35
|
+
pick_option "DigitalOcean" "AWS"
|
|
36
|
+
[ "$PICKED" = "1" ] && cloud=aws || cloud=digitalocean
|
|
43
37
|
echo ""
|
|
44
38
|
cmd_ground "$([ "$cloud" = "aws" ] && echo aws || echo do)" || {
|
|
45
39
|
echo ""
|
package/package.json
CHANGED