-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.sh
More file actions
25 lines (21 loc) · 820 Bytes
/
table.sh
File metadata and controls
25 lines (21 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
# examples/table.sh — Table widget demo (used by integration tests)
#
# Renders a navigable table of fruits. ENTER confirms selection; q quits.
# Prints "Selected: <label>" or "Aborted." to stdout on exit.
set -u
SHELLFRAME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$SHELLFRAME_DIR/shellframe.sh"
SHELLFRAME_TBL_LABELS=("apple" "banana" "cherry" "date" "elderberry")
SHELLFRAME_TBL_ACTIONS=("nothing" "nothing" "nothing" "nothing" "nothing")
SHELLFRAME_TBL_IDX=(0 0 0 0 0)
SHELLFRAME_TBL_META=("" "" "" "" "")
SHELLFRAME_TBL_SCROLL=0
SHELLFRAME_TBL_SELECTED=0
shellframe_table "" "" "↑/↓ move Enter confirm q quit"
_result=$?
if (( _result == 0 )); then
printf 'Selected: %s\n' "${SHELLFRAME_TBL_LABELS[$SHELLFRAME_TBL_SELECTED]}"
else
printf 'Aborted.\n'
fi