.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MYPAGER 1" .TH MYPAGER 1 "2018-10-17" "" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" mypager \- add color to mysql/psql clients text output .SH "SYNOPSYS" .IX Header "SYNOPSYS" Pager tool that will add color to query results of MySQL or PostgreSQL command line clients. It will also automatically use less when terminal isn't able to display the full result in one page. .PP mypager is meant to be used as a pager from the mysql or psql command line clients. .PP To use it you must configure them properly. .SS "\s-1USAGE\s0 (\s-1MYSQL\s0)" .IX Subsection "USAGE (MYSQL)" Inside the mysql client, use the \f(CW\*(C`pager\*(C'\fR command, then check using a simple select: .PP .Vb 2 \& pager mypager \& select 1; .Ve .PP Alternatively, you can set mypager as the default pager in your client configuration. .PP In \fI\f(CI$HOME\fI/.my.cnf\fR: .PP .Vb 2 \& [mysql] \& pager = mypager .Ve .SS "\s-1USAGE\s0 (\s-1PSQL\s0)" .IX Subsection "USAGE (PSQL)" Unlike the mysql client, there is no specific option in the psql client, you'll have to use the \s-1PAGER\s0 environment variable: .PP .Vb 1 \& PAGER=mypager psql \-\-connect\-options .Ve .PP You may wish to add an alias in your preferred shell rc: .PP .Vb 1 \& alias psql="PAGER=mypager psql" .Ve .PP Additionally, you'll need to change how query results are shown by editing your \fI\f(CI$HOME\fI/.psqlrc\fR file: .PP .Vb 2 \& \-\- Headers and surrounding pipes for columns \& \epset border 2 \& \& \-\- mypager will decide when to switch to less, but will always add color \& \epset pager always \& \& \-\- You may want null to be NULL, at your discretion \& \epset null NULL .Ve .SS "\s-1CONFIGURATION\s0" .IX Subsection "CONFIGURATION" Configuration is located in \fI\f(CI$HOME\fI/.mypager.conf\fR, you can create a new configuration file with the current defaults by using \f(CW\*(C`mypager \-\-installconf\*(C'\fR .PP It is also found in the script itself in the _\|_DATA_\|_ section .PP \fI\s-1CONFIGURATION OPTIONS\s0\fR .IX Subsection "CONFIGURATION OPTIONS" .PP Possible styles documented in Term::ANSIColor, you may combine them, for example \&\f(CW\*(C`bold cyan\*(C'\fR is a valid style .ie n .IP """style\-int""" 3 .el .IP "\f(CWstyle\-int\fR" 3 .IX Item "style-int" Text style for integer (or float) types. Default: green .ie n .IP """style\-null""" 3 .el .IP "\f(CWstyle\-null\fR" 3 .IX Item "style-null" Text style for the \s-1NULL\s0 value. Default: cyan .ie n .IP """style\-nudatell""" 3 .el .IP "\f(CWstyle\-nudatell\fR" 3 .IX Item "style-nudatell" Text style for datetimes (and date) values. Default: yellow .ie n .IP """style\-header""" 3 .el .IP "\f(CWstyle\-header\fR" 3 .IX Item "style-header" Text style for row headers. Default: underline .ie n .IP """style\-row""" 3 .el .IP "\f(CWstyle\-row\fR" 3 .IX Item "style-row" Text style for row header when mysql is used with the \f(CW\*(C`\eG\*(C'\fR flag. Default: magenta .ie n .IP """long\-lines\-to\-less""" 3 .el .IP "\f(CWlong\-lines\-to\-less\fR" 3 .IX Item "long-lines-to-less" Defaults to 1. .Sp When 1: mypager will switch to less if it encounters any line longer than screen width (even if they fit within the height of the screen) .Sp When 0: it will only take the height as variable to switch to less. .ie n .IP """less\-options""" 3 .el .IP "\f(CWless\-options\fR" 3 .IX Item "less-options" Options passed on the the \f(CW\*(C`less\*(C'\fR executable, default to \f(CW\*(C`\-S\*(C'\fR (chop long lines) .ie n .IP """less\-options\-overrides\-env""" 3 .el .IP "\f(CWless\-options\-overrides\-env\fR" 3 .IX Item "less-options-overrides-env" Defaults to 0 .Sp If the \f(CW$LESS\fR environment variable is already set, the default is to set our config options (\*(L"less-options\*(R") with a lower priority (in case of conflicts) Set to 1 to \*(L"override\*(R" the environment variable options .IP "use-less" 3 .IX Item "use-less" Determine when mypager will use the less executable Valid options: \f(CW\*(C`auto\*(C'\fR, \f(CW\*(C`always\*(C'\fR, \f(CW\*(C`never\*(C'\fR, default is \f(CW\*(C`auto\*(C'\fR .IP "fix\-utf8" 3 .IX Item "fix-utf8" Use to \*(L"fix\*(R" broken MySQL client \s-1UTF\-8\s0 output. .Sp This bug was fixed a while ago, so this option is disabled by default