init
This commit is contained in:
6
examples/curpos
Normal file
6
examples/curpos
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
pos="$(tui_curpos)"
|
||||
printf 'Cursor position: COLUMN=%s LINE=%s\n' "${pos% *}" "${pos#* }"
|
9
examples/readchar
Normal file
9
examples/readchar
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
num="${1:-1}"
|
||||
printf 'Usage: readchar NUMBER\n'
|
||||
printf 'Input characters (number=%s):\n' "$num"
|
||||
tui_readchar -n "$num" VAR
|
||||
echo Characters: $VAR
|
7
examples/readkey
Normal file
7
examples/readkey
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
printf 'Press any key. Key will printed below.\n'
|
||||
tui_readkey KEY
|
||||
printf 'Key pressed: %s\n' "$KEY"
|
17
examples/readkey_2
Normal file
17
examples/readkey_2
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
printf 'Press arrow keys, q to quit.\n'
|
||||
|
||||
while true; do
|
||||
tui_readkey KEY
|
||||
case "$KEY" in
|
||||
Up) printf 'Move UP\n';;
|
||||
Down) printf 'Move DOWN\n';;
|
||||
Left) printf 'Move LEFT\n';;
|
||||
Right) printf 'Move RIGHT\n';;
|
||||
q|Q) break;;
|
||||
*) :
|
||||
esac
|
||||
done
|
5
examples/select
Normal file
5
examples/select
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
tui_select First Second 'Another one'
|
18
examples/spin
Normal file
18
examples/spin
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ../tui.sh
|
||||
|
||||
tui_spin \
|
||||
-t 'Sleeping...' \
|
||||
-m '\033[32;1m✓ Waked up!\033[0m' \
|
||||
-- sleep 3
|
||||
|
||||
tui_spin -r \
|
||||
-t 'Ping Google...' \
|
||||
-m '\033[32;1m✓ Ping Google OK!\033[0m' \
|
||||
-- ping -c 3 google.com
|
||||
|
||||
tui_spin \
|
||||
-t 'Search *bash* files...' \
|
||||
-m '\033[32;1m✓ Search *bash* files OK!\033[0m' \
|
||||
-- find ~ -name "*bash*"
|
Reference in New Issue
Block a user