Skip to content

Commit c5b825c

Browse files
committed
wip: Add command that supports tput-like argumnets
1 parent da5bd20 commit c5b825c

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

pkg/src/public/bash-tput.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# shellcheck shell=bash
2+
3+
# TODO
4+
# https://wiki.bash-hackers.org/scripting/terminalcodes
5+
# https://stackoverflow.com/a/20983251
6+
7+
bty() {
8+
unset REPLY
9+
10+
case $1 in
11+
# controlling cursor
12+
sc) ;;
13+
rc) ;;
14+
home) ;;
15+
cup) ;;
16+
cud1) ;;
17+
cuu1) ;;
18+
civis) ;;
19+
cnorm) ;;
20+
21+
# terminal attributes
22+
longname) ;;
23+
lines) ;;
24+
cols) ;;
25+
colors) ;;
26+
27+
# text effects
28+
bold) ;;
29+
smul) ;;
30+
rmul) ;;
31+
rev) ;;
32+
blink) ;;
33+
invis) ;;
34+
smso) ;;
35+
rmso) ;;
36+
sgr0) ;;
37+
setaf)
38+
case $2 in
39+
[0-9]) ;;
40+
*) ;;
41+
esac
42+
;;
43+
setab)
44+
case $2 in
45+
[0-9]) ;;
46+
*) ;;
47+
esac
48+
;;
49+
dim) ;;
50+
51+
# clearing screen'
52+
smcup) ;;
53+
rmcup) ;;
54+
el) tty.erase_line_end ;;
55+
el1) tty.erase_line_start ;;
56+
el2) tty.erase_line ;;
57+
clear) ;;
58+
*)
59+
60+
return
61+
esac
62+
63+
# shellcheck disable=SC2059
64+
printf "$REPLY"
65+
}

0 commit comments

Comments
 (0)