-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathzzmariadb.sh
72 lines (68 loc) · 1.63 KB
/
zzmariadb.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# ----------------------------------------------------------------------------
# Lista alguns dos comandos já traduzidos do banco MariaDB, numerando-os.
# Pesquisa detalhe dos comando, ao fornecer o número na listagem a esquerda.
# E filtra a busca se fornecer um texto.
#
# Uso: zzmariadb [ código | filtro ]
# Ex.: zzmariadb # Lista os comandos disponíveis
# zzmariadb 18 # Consulta o comando DROP USER
# zzmariadb alter # Filtra os comandos que possuam alter na declaração
#
# Autor: Itamar <itamarnet (a) yahoo com br>
# Desde: 2013-07-03
# Versão: 4
# Requisitos: zzzz zztool zzminusculas zzsemacento zztrim
# Tags: internet, consulta
# ----------------------------------------------------------------------------
zzmariadb ()
{
zzzz -h mariadb "$1" && return
local url='https://mariadb.com/kb/pt-br'
local cache=$(zztool cache mariadb)
local comando
if test '--atualiza' = "$1"
then
zztool atualiza mariadb
shift
fi
if ! test -s "$cache"
then
zztool dump "${url}/mariadb-brazilian-portuguese/" |
sed -n '/^\( *\* \)\{0,1\}[A-Z]\{4,\}/p' |
sed 's/ *\* *//' |
awk '{print NR, $0}'> "$cache"
fi
if test -n "$1"
then
if zztool testa_numero "$1"
then
comando=$(
sed -n "${1}p" "$cache" |
sed "
s/^${1} //
s| / |-|g
s/ - /-/g
s/ /-/g
s/\.//g
" |
zzminusculas |
zzsemacento
)
zztool dump "${url}/${comando}/" |
sed -n '/^ *Localized Versions/,/\* ←/ p' |
sed '
1d
2d
/^ *\*.*\]$/d
/^ *Tweet */d
/^ *\* *$/d
$d
' |
zztrim -V
else
grep -i "$1" "$cache"
fi
else
cat "$cache"
fi
}