-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzcurses-exemplo.sh
More file actions
37 lines (32 loc) · 825 Bytes
/
zcurses-exemplo.sh
File metadata and controls
37 lines (32 loc) · 825 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
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/zsh -f
#
# Exemplo bem simples de uso do modulo 'curses' do zsh para "desenho
# de janelas" em interfaces CLI.
#
# Autor: Sandro Marcell
# Email: [email protected]
# Blog: http://www.my.opera.com/smarcell/blog
#
# Uso: ./nome_script 'string'
#
# Mais detelhes:
# man zshmodules
# info zsh
#
zmodload zsh/curses
function mostraMensagem {
local string="$1"
[ -z "$string" ] && string='Hello World! =)'
zcurses init
zcurses addwin main $(($LINES - 19)) $(($COLUMNS - 2)) $(($LINES - 15)) 1
zcurses border main
zcurses attr main red/black bold
zcurses move main 2 $((($COLUMNS - $#string - 2) / 2))
zcurses string main "$string"
zcurses refresh main
sleep 3
zcurses delwin main
zcurses end
return 0
}
mostraMensagem "$1"