okbob / pspg

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.
BSD 2-Clause "Simplified" License
2.45k stars 85 forks source link

Respect XDG spec? #166

Closed topazape closed 3 years ago

topazape commented 3 years ago

Would it be possible to respect the XDG specification for config and history files generated by locating them in ${XDG_CONFIG_HOME}/pspg/pspgconf and ${XDG_CACHE_HOME}/pspg/pspg_history rather than in $HOME?

okbob commented 3 years ago

po 26. 4. 2021 v 4:00 odesílatel topazape @.***> napsal:

Would it be possible to respect the XDG specification for config and history files generated by locating them in ${XDG_CONFIG_HOME}/pspg/pspgconf and ${XDG_CACHE_HOME}/pspg/pspg_history rather than in $HOME?

Technically there is not any problem. But pspg is a twin of psql, and what I know psql does not follow XDG. So there can be inconsistency. I am not sure how much XDG is widely used.

For example, XDG_CONFIG_HOME and XDG_CACHE_HOME are not supported on my really fresh Fedora 34

@.*** pspg-master]$ set|grep XDG XDG_CURRENT_DESKTOP=GNOME XDG_DATA_DIRS=/home/pavel/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/ XDG_MENU_PREFIX=gnome- XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP=gnome-xorg XDG_SESSION_TYPE=x11 local -a dirs=(${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions); for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share};

So XDG support can have a lot of issues.

I am not an expert on this area - What benefits are when XDG is supported and what negatives when not?

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/166, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO43Z4SAKRXT7BEGDN6DTKTCMFANCNFSM43R5KT4A .

topazape commented 3 years ago

Thanks for your reply.

Although psql does not follow the XDG, it is possible to control the placement of configuration and history files by using environment variables ($PSQLRC and $PSQL_HISTORY). Since pspg is a great software, if it is a twin of psql, can it also support configuration file placement by environment variables?

Thank you,

okbob commented 3 years ago

I introduced variables PSPG_CONF and PSPG_HISTORY https://github.com/okbob/pspg/commit/37943a68425b13c64b972a544e5834b580cf943d - please check

topazape commented 3 years ago

I have compiled and run the new version and confirmed that the environment variables (PSPG_CONF and PSPG_HISTORY) are read correctly. Thank you very much for your quick response!