Skip to content

Instantly share code, notes, and snippets.

@islander
Last active December 16, 2015 04:29
Show Gist options
  • Save islander/5377319 to your computer and use it in GitHub Desktop.
Save islander/5377319 to your computer and use it in GitHub Desktop.
MySQL CLI client customization
# grcat - apt-get install grc
# разделители строк для вертикального вывода результатов с помощью \G
regexp=[*]+.+[*]+
count=stop
colours=white
-
# границы таблиц
regexp=[+\-|]+
colours=red
-
# цвет текста по умолчанию
regexp=[\w\.]+
colours=green
-
# текст в скобках ( ) и кавычках ' '
regexp=\([\w\d,']+\)
colours=white
-
# числа
regexp=\s[\d\.]+\s
colours=yellow
-
# имена полей при вертикальном выводе с помощью \G
regexp=\w+:
colours=white
-
# даты
regexp=\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}
colours=cyan
-
# IP
regexp=(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?
colours=cyan
-
# MAC
regexp=([0-9a-f]{2}[:-]){5}([0-9a-f]{2})
colours=red
-
# поля, таблицы и другие системные сущности в символах ` `
regexp=`\w+`
colours=yellow
-
# email
regexp=[\w\.\-_]+@[\w\.\-_]+
colours=magenta
### MySQL CLI client customization ###
[mysql]
pager = ~/mysql_table_border_customize | grcat ~/.grcat | less -RSFinX
no-auto-rehash
prompt = '\u@\h (\d) > '
# FYI: safe-updates option adds LIMIT 1000 to all SELECT queries, be careful
safe-updates
#!/bin/sed -f
### Customize table borders ###
s!^|!║!g;s!|$!║!g;s!|!│!g;
/^+/bp;b
:p x;/^╔/bm;/^╟/bl
:f x;s!^+!╔!;s!-!═!g;s!+$!╗!;s!+!╤!g;h;b
:m x;s!^+!╟!;s!-!─!g;s!+$!╢!;s!+!┼!g;h;b
:l x;s!^+!╚!;s!-!═!g;s!+$!╝!;s!+!╧!g;h;b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment