dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.49k stars 663 forks source link

How to use pspg as the pager? #1003

Open zer09 opened 3 years ago

zer09 commented 3 years ago

I tried this on my .my.cnf

[client]
pager = pspg -X --quit-if-one-screen

But mysqldump doesn't like it.

schmeic commented 3 years ago

From my experience, there is no way to set the pager in .my.cnf (or any other mysql config file) that will work with all of: mysql (cli), mysldump, and mycli. See #881 - what really needs to be done is to support this in .myclirc

What I've been doing is just manually setting it every time I start mycli like this: > pager pspg

UrGuardian4ngel commented 3 years ago

I have a similar issue, and I worked around that for now using --defaults-group-suffix.

My ~/.my.cnf looks like this now:

[client]
user = lorem

[client_visidata]
pager = vd --filetype=tsv

[mysql_visidata]
silent
raw

By default, e.g. mysqldump will just see the [client] section.

In my shell, I have a wrapper script (or it could be an alias) that appends --defaults-group-suffix='_visidata':

$ mysql --defaults-group-suffix='_visidata' # ...

$ mycli --defaults-group-suffix='_visidata' # ...

That basically makes mysqli and mycli see both contents of [client] and [client_visidata] as a single merged [client] group.
And same happens for other configuration groups.

zer09 commented 3 years ago

@UrGuardian4ngel WOW! thank you, this works great. Exactly what I needed.